Hi,
I have a question in reference to this old thread:
https://www.imagemagick.org/discourse-s ... hp?t=16699
Basically I have the same issue as discussed in the first three posts in the thread. I downsize an image using ImageMagick and retain the embedded color profile. For black&white images, ImageMagick changes the JPEG type to greyscale, when then opening the downsized file, Photoshop complains about an invalid profile, because it does not like the RGB color profile embedded in an greyscale JPEG. In the thread, the problem is solved by forcing ImageMagick to stick with a color JPEG (-type TrueColor).
However, I do not want to enforce the color JPEG, because going for greyscale actually saves a few kilobytes. So what would be the correct solution if I want to do that? Would I need to embed a different color profile? Where would I get that profile from?
Thanks!
Cheers, Robert
Which color profile for greyscale JPEG?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Which color profile for greyscale JPEG?
I would "-strip" the profile. Then any software will assume the the tonal values are sRGB. For accuracy, you should convert it to an sRGB profile before stripping, and you should do this before converting to grayscale, for example:
Code: Select all
convert in.jpg -profile sRGB.icc -strip -colorspace Gray out.jpg
snibgo's IM pages: im.snibgo.com
Re: Which color profile for greyscale JPEG?
Hi Snibgo,
Thanks for your response! Do you have an idea how I could detect if an image is grey-scale in the first place? My code needs to be able to handle both color and grey-scale pictures.
Regards, Robert
Thanks for your response! Do you have an idea how I could detect if an image is grey-scale in the first place? My code needs to be able to handle both color and grey-scale pictures.
Regards, Robert
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Which color profile for greyscale JPEG?
One of the escapes should give that, perhaps %[type]. See http://www.imagemagick.org/script/escape.php
snibgo's IM pages: im.snibgo.com