I have not tested the snippet below, but this might be a good starting point for you.
ImageInfo info = new ImageInfo("myImage.jpg");
boolean isCMYK = info.getColorspace() == ColorspaceType.CMYKColorspace;
if(isCMYK) {
info.setColorspace(ColorspaceType.RGBColorspace);
}
ozhan source
share