I am investigating it… I did some tests and when I check the next condition:
img.getColorModel().getColorSpace().getType() == ColorSpace.TYPE_CMYK
I get always false. Debugging my code, I see that the color space is returned as RGB, so this condition cannot be true.
To arrive to this point, I get the image from the external server and I save it in my local server. It is recommended that the final solution doesn’t do that and work always in memory without save temp files.
The picture saved in my hard drive has wrong colours.
I’m a bit lost.