imagemagickrgbphotoshopcolor-profilecolor-management

ImageMagick: Invalid ICC profile after conversion


I wrote an application which trims and resizes a bunch of images via ImageMagick. The images are also converted to grayscale. But when I try to open a converted image in Photoshop CC, the following warning appears:

The embedded ICC profile cannot be used because the ICC profile is invalid, ignoring the profile.

Plus, the image profile is in grayscale, but I want it to be in RGB. How can I achieve this with ImageMagick? I played around with the different parameters, but none worked for me.

This command is currently in use:

convert ${src} -type grayscale -set colorspace RGB -background white -gravity center -extent ${longest}x${longest} ${dest}

Also, this one didn't work either:

convert.exe ${src} -set colorspace RGB -set profile RGB.icc ${dest}

Solution

  • A simple way to force the output PNG to be RGB is to replace $(dest) in your command with PNG24:$(dest), or use PNG32:$(dest) if your image has transparency). If you do this, then your existing RGB color profile will be OK.

    You can also try PNG8:$(dest) which will be OK if you have fewer than 256 gray levels, and will result in a smaller file size.