Page 1 of 1

possible bug JPG,PNG type=truecolor grayscale IM 6.8.8.2 Q16

Posted: 2014-01-15T18:17:40-07:00
by fmw42
This is a follow up to viewtopic.php?f=2&t=24801

IM 6.8.8.2 Q16 Mac OSX Snow Leopard

I did a test with -colorspace grayscale -type truecolor for jpg and png. It seems that Exiftool does not recognize the 3 channels.

Perhaps other format specific tools will know the difference.

Do I misunderstand what to expect or have I made an error in this?


convert rose: -colorspace gray -type truecolor rose_gray.jpg
Fred-Weinhauss-Mac-mini:desktop fred$ exiftool -s -ee -g1 -u -n -D rose_gray.jpg---- ExifTool ----
- ExifToolVersion : 8.71
---- System ----
- FileName : rose_gray.jpg
- BitsPerSample : 8
- ColorComponents : 1
---- Composite ----
- ImageSize : 70x46


convert rose: -colorspace gray -type truecolor rose_gray.png
Fred-Weinhauss-Mac-mini:desktop fred$ exiftool -s -ee -g1 -u -n -D rose_gray.png---- ExifTool ----
- ExifToolVersion : 8.71
---- System ----
- FileName : rose_gray.png
0 ImageWidth : 70
4 ImageHeight : 46
8 BitDepth : 8
9 ColorType : 0



Also for PNG, the png data from identify -verbose still shows grayscale.

png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 0
png:IHDR.color_type: 0 (Grayscale)

Re: possible bug JPG,PNG type=truecolor grayscale IM 6.8.8.2

Posted: 2014-01-15T18:35:43-07:00
by glennrp
If you must have an RGB 8-bit-per-sample PNG, then use png24:output.png

Re: possible bug JPG,PNG type=truecolor grayscale IM 6.8.8.2

Posted: 2014-01-15T20:27:23-07:00
by fmw42
glennrp wrote:If you must have an RGB 8-bit-per-sample PNG, then use png24:output.png

Thanks, Glenn. That gets around it for PNG. Exiftool reports:
ColorType : 2


But magick said to report this also if jpg did not work (according to http://www.imagemagick.org/Usage/formats/#jpg_write)

Snibgo, can you report with your jpgdump tool what you get for the following:

convert rose: -colorspace gray -type truecolor rose_gray.jpg

Re: possible bug JPG,PNG type=truecolor grayscale IM 6.8.8.2

Posted: 2014-01-15T23:55:44-07:00
by eefi
I believe I've tracked this down to a change between 6.7.6-10 and 6.7.7-10. Running

Code: Select all

convert rose: -colorspace gray -type truecolor rose_gray.jpg
with 6.7.6-10 results in a file that opens in RGB mode in GIMP 2.8.6, but 6.7.7-10 outputs a file that opens in Grayscale mode.

I built my binaries in fresh Debian GNU/Linux sid chroots with only libjpeg8-dev available as an extra dependency.

Another test case for this bug can be found in this other forum thread: viewtopic.php?f=1&t=23421&start=15#p106918

Re: possible bug JPG,PNG type=truecolor grayscale IM 6.8.8.2

Posted: 2014-01-16T02:16:49-07:00
by snibgo
IM v6.8.8-0 on Windows 8.1.

Code: Select all

F:\web\im>%IM%convert rose: r.jpg

F:\web\im>dumpjpeg /ir.jpg
      Input: /i r.jpg
r.jpg: JPEG image is 70w * 46h, 3 color components, 8 bits per sample
JPEG process: Baseline
width 70, height 46

F:\web\im>%IM%convert rose: -colorspace gray r.jpg

F:\web\im>dumpjpeg /ir.jpg
      Input: /i r.jpg
r.jpg: JPEG image is 70w * 46h, 1 color components, 8 bits per sample
JPEG process: Baseline
width 70, height 46

F:\web\im>%IM%convert rose: -colorspace gray -type truecolor r.jpg

F:\web\im>dumpjpeg /ir.jpg
      Input: /i r.jpg
r.jpg: JPEG image is 70w * 46h, 1 color components, 8 bits per sample
JPEG process: Baseline
width 70, height 46
So "-type truecolor" does not work afer "-colorspace gray".

Weirdly "-type truecolor" does work afer "-monochrome":

Code: Select all

F:\web\im>%IM%convert rose: -monochrome r.jpg

F:\web\im>dumpjpeg /ir.jpg
      Input: /i r.jpg
r.jpg: JPEG image is 70w * 46h, 1 color components, 8 bits per sample
JPEG process: Baseline
width 70, height 46

F:\web\im>%IM%convert rose: -monochrome -type truecolor r.jpg

F:\web\im>dumpjpeg /ir.jpg
      Input: /i r.jpg
r.jpg: JPEG image is 70w * 46h, 3 color components, 8 bits per sample
JPEG process: Baseline
width 70, height 46

Re: possible bug JPG,PNG type=truecolor grayscale IM 6.8.8.2

Posted: 2014-01-16T06:36:23-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.8-3 Beta, available by sometime tomorrow. Thanks.