#766104 [graphicsmagick] converting tiff to 4 bit grayscale doesn't work

Package:
graphicsmagick
Source:
graphicsmagick
Description:
collection of image processing tools
Submitter:
Markus Grunwald
Date:
2014-10-20 22:12:09 UTC
Severity:
normal
#766104#5
Date:
2014-10-20 21:10:22 UTC
From:
To:
--- Please enter the report below this line. ---

I'm using gm for heavy work with tiff-files. Unfortunately I have to use
ImageMagick to convert to 4 bit grayscale tifs. Use the attached testfile for
reference:

% gm convert -compress LZW testpicture.tif -colors 16 -colorspace GRAY -depth 4 testpicture_4bit_gm.tif
% convert -compress LZW testpicture.tif -colors 16 -colorspace GRAY -depth 4 testpicture_4bit_im.tif
% identify testpicture*.tif
testpicture_4bit_gm.tif TIFF 256x256 256x256+0+0 8-bit sRGB 18.7KB 0.000u 0:00.000
testpicture_4bit_im.tif[1] TIFF 256x256 256x256+0+0 4-bit Grayscale Gray 8.44KB 0.000u 0:00.000
testpicture.tif[2] TIFF 256x256 256x256+0+0 8-bit Grayscale Gray 8.08KB 0.000u 0:00.000

-> The gm created image is 8 bit sRGB while ImageMagich creates the 4 bit
grayscale as requested...

I tried to report the bug upstream but find the sourcefourge.net webinterface
unusable.

Thanks,
Markus
--- Package information. --- Depends (Version) | Installed =================================-+-=========== libc6 (>= 2.2.5) | libgomp1 (>= 4.2.1) | libgraphicsmagick3 (>= 1.3.5) | Package's Recommends field is empty. Suggests (Version) | Installed =================================-+-=========== graphicsmagick-dbg |
#766104#10
Date:
2014-10-20 21:54:14 UTC
From:
To:
GraphicsMagick processes options in the order left to right.
GraphicsMagick uses -depth to control the color quantum precision and
not the storage depth and this option is losing the colormap.  It is
likely best convert to grayscale before quantizing the colors.

This works with GraphicsMagick 1.3.20:

   gm convert input.tif -colorspace GRAY -colors 16 output.tif

To be completely specific about TIFF output bits/sample, do

   gm convert input.tif -colorspace GRAY -colors 16 \
       -define tiff:bits-per-sample=4 output.tif

When you are specific about bits/sample with a colormapped image, you
need to be careful that the colormap fits the specified bits/sample.

Sorry to hear that the SourceForge web interface is unusable.

Bob