I have a project which will require me to convert a very large number (millions) of greyscale TIFFs to smaller, lower depth GIF files for display on screen.
I have tried this conversion using both IM and Nconvert (from XnView). I want to use IM, because it supports multi-processors...but currently Nconvert is just kicking its butt on final file size output. Nconvert is not multi-threaded though, so it can't take full advantage of our quad-core workstation.
I need help looking for ways to make IM create a smaller file. I am new to IM, so perhaps I am simply feeding it the wrong parameters.
I am starting with a 379KB greyscale TIFF which is 1856x768. I want the final image to be 1024px wide and resize height proportionally. This scan is simply writing on a white page using pencil. So full 256-color greyscale is not needed, but some grey is need (pure B&W looks unreadable). Using Nconvert's -grey 8 (8-bit greyscale) option, the 379KB file results in a new 39KB 1024x423 GIF.
Using IM with the "convert.exe -depth 2 -type optimize -resize 1024x1024" options, I get a 109KB GIF of the same size (1024x423). Obviously I am doing something wrong, or IM just can't compete on this particular project.
Help!
Thanks!
P.S. -- I don't HAVE to use GIF. PNG would also work for this project...but I figured GIF would be smaller in this case. But if you can make PNG work better, those suggestions would be welcome too!
Need help optimizing greyscale GIF output
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Need help optimizing greyscale GIF output
try using -quantize gray +dither -colors xx where xx is the number of shades of gray you want.
see
http://www.imagemagick.org/Usage/quantize/
http://www.imagemagick.org/Usage/quantize/#colors
http://www.imagemagick.org/Usage/quantize/#quantize
http://www.imagemagick.org/Usage/formats/#gif
convert inputimage -resize 1024x1024 -quantize gray +dither -colors 16 outputimage.gif
see
http://www.imagemagick.org/Usage/quantize/
http://www.imagemagick.org/Usage/quantize/#colors
http://www.imagemagick.org/Usage/quantize/#quantize
http://www.imagemagick.org/Usage/formats/#gif
convert inputimage -resize 1024x1024 -quantize gray +dither -colors 16 outputimage.gif
Re: Need help optimizing greyscale GIF output [solved]
Perfect! Thanks!
With 8 shades of gray, IM created a 37KB file, and with 6 or 4 it went even lower (but those may be too low of quality).
There are simply so many options with IM that I had not yet discovered "quantize" and +dither and the proper combination of the switches. I figured IM could at least match Nconvert for optimization, and it actually beat it by a hair.
Thanks again.
With 8 shades of gray, IM created a 37KB file, and with 6 or 4 it went even lower (but those may be too low of quality).
There are simply so many options with IM that I had not yet discovered "quantize" and +dither and the proper combination of the switches. I figured IM could at least match Nconvert for optimization, and it actually beat it by a hair.
Thanks again.