Watchout for Greyscale Jpeg!
Posted: 2012-05-17T17:21:56-07:00
With teh colorspace changes, and the backporting of some coders from IMv7 (which has true single-channel grayscale images in memory). A inconsistency has developed in JPEG colorspace management.
In older (last year) versions of IM, saving a grayscale image in JPEG, will generate a light weight single channel grayscale JPEG image file format.
An example is... invitation_box.jpg
Newer versions of IM however will save this as a sRGB multi-channel image, in which case the next step has no problems.
Now the problem is this image is marked as 'grayscale' so if you load, color it, and save again. IM still thinks it is grayscale, and IM JPEG saves a grayscale version of the image!
This I would regard as a bug, though IM does think of it as Grayscale, so realy the bug could be considered to be in +level-colors. I have not tested in IMv7 where this type of this is more common.
The workaround, is to ensure the image is not thought of as grayscale before saving (can be done at any time).
Note this problem will probably happen for ANY operator that may convert a image marked as being grayscale, to a colored image, in BOTH IMv6 and IMv7.
ASIDE: the example used come from IM Examples, Coloring a Gray-scale Text Image
http://www.imagemagick.org/Usage/text/#coloring_text
In older (last year) versions of IM, saving a grayscale image in JPEG, will generate a light weight single channel grayscale JPEG image file format.
An example is... invitation_box.jpg
Newer versions of IM however will save this as a sRGB multi-channel image, in which case the next step has no problems.
Now the problem is this image is marked as 'grayscale' so if you load, color it, and save again. IM still thinks it is grayscale, and IM JPEG saves a grayscale version of the image!
Code: Select all
convert invitation_box.jpg +level-colors navy,lightblue invitation_still_black_and_white.jpg
This I would regard as a bug, though IM does think of it as Grayscale, so realy the bug could be considered to be in +level-colors. I have not tested in IMv7 where this type of this is more common.
The workaround, is to ensure the image is not thought of as grayscale before saving (can be done at any time).
Code: Select all
convert invitation_box.jpg -colorspace sRGB \
+level-colors navy,lightblue invitation_still_black_and_white.jpg
Note this problem will probably happen for ANY operator that may convert a image marked as being grayscale, to a colored image, in BOTH IMv6 and IMv7.
ASIDE: the example used come from IM Examples, Coloring a Gray-scale Text Image
http://www.imagemagick.org/Usage/text/#coloring_text