Page 1 of 1
possible bug preserving color after append
Posted: 2016-02-04T16:42:34-07:00
by fmw42
I am having difficulty preserving a color image after appending a bilevel image with two color images (only when the bilevel image is first in the list). What am I doing wrong or is this a bug?
Code: Select all
convert rose: -compress none rose.tif
Code: Select all
convert rose: -threshold 25% rose_t25.png
These two following appends produce a grayscale result rather than color (for the last two images).
Code: Select all
convert rose_t25.png rose.tif rose.tif -append -type truecolor -define png:color-type=2 PNG24:rose_append.png
Code: Select all
convert rose_t25.png rose.tif rose.tif -append -type truecolor -compress lzw rose_append.tif
Whereas the following works if the bilevel image is not first:
Code: Select all
convert rose.tif rose_t25.png rose.tif -append rose_append2.png
Mac OSX Snow Leopard
Code: Select all
convert -version
Version: ImageMagick 6.9.3-2 Q16 x86_64 2016-01-27 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms lqr ltdl lzma openexr png ps rsvg tiff webp x xml zlib
Re: possible bug preserving color after append
Posted: 2016-02-04T18:17:21-07:00
by magick
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @
https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @
http://www.imagemagick.org/download/beta/ by sometime tomorrow.
Re: possible bug preserving color after append
Posted: 2016-12-06T20:21:58-07:00
by BzzBzz
Hello. I will bump this thread to report this bug still exist (partially at least) in IM 6.9.5
Edit: not sure if it's same bug, but looks similar to me.
I want to merge 24-bit color "color.jpg" and 8-bit grayscale "gray.jpg" into single image.
When I do
Code: Select all
convert +append color.jpg gray.jpg out.jpg
There's no problem and resulting image is 24-bit color JPEG image.
Problems starts if first image is grayscale
Code: Select all
convert +append gray.jpg color.jpg out.jpg
Result is
8-bit grayscale JPEG. <== bug!
However there's no problems if I use PNG for output.
Code: Select all
convert +append gray.jpg color.jpg out.png
Result is
24-bit color PNG. <== ok.
Win7 x64, Cygwin
Code: Select all
convert --version
Version: ImageMagick 6.9.5-7 Q16 x86_64 2016-08-27 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC OpenMP
Delegates (built-in): autotrace bzlib cairo fftw fontconfig fpx freetype gslib jbig jng jp2 jpeg lzma pangocairo png ps rsvg tiff webp x xml zlib
Re: possible bug preserving color after append
Posted: 2016-12-06T21:14:34-07:00
by fmw42
try reading the input images before the +append followed by the output image. The proper IM 6 syntax is to read the inputs, then the settings, then the operators, then the output. See
http://www.imagemagick.org/Usage/basics/#why
This works fine for me on IM 6.9.6.6 Q16 Mac OSX
Code: Select all
convert \( rose: -colorspace gray \) rose: +append test.png
It also works fine for me in IM 6.9.6.5 Q16 Mac OSX
Re: possible bug preserving color after append
Posted: 2016-12-06T21:30:44-07:00
by BzzBzz
Nope.
Code: Select all
convert gray.jpg color.jpg +append out.jpg
Still results in 8-bit jpeg.
There's no bug if output set to png, bmp or tif, I even tried archaic pcx. For some reason only JPEG
output is bugged.
Try this (I only changed output format in your example) and it will bug out.
Code: Select all
convert \( rose: -colorspace gray \) rose: +append test.JPG
Re: possible bug preserving color after append
Posted: 2016-12-06T21:56:01-07:00
by fmw42
You are correct. It fails for jpg output.
Code: Select all
convert \( rose: -colorspace gray \) rose: +append test.jpg
However, this works
Code: Select all
convert \( rose: -colorspace gray \) rose: +append -type truecolor test.jpg
But I think it is still a bug. One should not have to force type=truecolor. It should use the highest color depth automatically, in my opinion. However, often IM will take the settings from the first image in the sequence. But if it works automatically for PNG, TIFF, then it should also do so for JPG (my opinion).
Re: possible bug preserving color after append
Posted: 2016-12-07T15:30:07-07:00
by magick
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @
https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @
http://www.imagemagick.org/download/beta/ by sometime tomorrow.