Cannot append color image to grayscale image - IM 6.9.0-2
Posted: 2014-12-29T02:00:22-07:00
Hi everyone,
Since the upgrade to 6.8, which included some major changes in color management, the convert -append command has been broken when dealing with mixed grayscale and color images. Consider the following command:
(The images I'm using are available here and here. They were exported from Lightroom and then scaled down with convert -resize)
The expected and correct result should be that both.jpg is a color image, of which the top half shows the contents of bw.jpg and the bottom half the contents of color.jpg. However, the actual and incorrect result is that both.jpg is a grayscale image. This can be observed by opening it in any image viewer or with the identify command:
I have tried to explicitly specify the colorspaces and image types, but to no avail:
This behavior only occurs when the grayscale image is the first to be appended. The following code produces the correct result:
It seems that ImageMagick decides on the output colorspace depending on the colorspace of its first argument, and that this behavior cannot be overruled. This bug affects me greatly, since I have a photographer client whose online portfolio suddenly contains grayscale preview icons. If there is any workaround that successfully combines bw.jpg and color.jpg, please let me know!
Since the upgrade to 6.8, which included some major changes in color management, the convert -append command has been broken when dealing with mixed grayscale and color images. Consider the following command:
Code: Select all
$ convert bw.jpg color.jpg -append both.jpg
The expected and correct result should be that both.jpg is a color image, of which the top half shows the contents of bw.jpg and the bottom half the contents of color.jpg. However, the actual and incorrect result is that both.jpg is a grayscale image. This can be observed by opening it in any image viewer or with the identify command:
Code: Select all
$ identify -verbose both.jpg | grep Colorspace
Colorspace: Gray
Code: Select all
$ convert -colorspace sRGB -type truecolor bw.jpg -colorspace sRGB -type truecolor color.jpg -append -colorspace sRGB -type truecolor both.jpg
Code: Select all
$ convert color.jpg bw.jpg -append both.jpg