Page 1 of 1

Very Slow TIFF->GIF conversion

Posted: 2007-08-26T08:31:47-07:00
by mr_walsh
When I convert a monochrome TIFF file to a GIF, it takes around *7 seconds*.

Converting to a JPG is done in under a second.

The only clue I have is if I use the -monitor flag I see it taking 3 seconds each for the 'Classify image colors' and 'Dither image colors' steps (see below).

I guess I don't get it since the image is monochrome! Why would it take time to classify 2 colors, or to dither when there's nothing to dither! I even tried to be 100% sure by converting the TIFF to monochrome first, but got the same results.

Help!

Is there some way to really force it to not play with the colors?

Code: Select all

convert -monitor -monochrome t2.tiff blah.gif
Load image: 100%
Classify image colors: 100%
Dither image colors: 100%
Save image: 100%

Re: Very Slow TIFF->GIF conversion

Posted: 2007-08-28T00:08:24-07:00
by anthony
Must be a VERY big image. GIF is a limited format with only 256 colors IM has to do a LOT of work to find the best colors to use, based on all the colors in the original image, and then replace all the pixel colors with an appropriate dither pattern on those colors. Basically this is a lot of work.

JPG on the other hand just lossy compresses the color. It does not have to 'quantize' the colors. Nor does PNG.

Re: Very Slow TIFF->GIF conversion

Posted: 2007-08-28T07:43:48-07:00
by mr_walsh
Yeah, but the source image has 2 colors - black and white - not even any greys. Isn't there a way to shortcut the process in cases like this? There's nothing to sample or dither.

Re: Very Slow TIFF->GIF conversion

Posted: 2007-08-29T22:19:13-07:00
by anthony
YES use +dither -map pattern:gray50

that sets a color map without dithering to the images. If the colors in the images
match the colormap than it does not have to quantize the image!

Let us know how it goes an what improvement it gives, so I can note it in IM examples.

Re: Very Slow TIFF->GIF conversion

Posted: 2007-08-30T08:38:50-07:00
by mr_walsh
Ok, it does improve things significantly, but it's still pretty doggy...the 'assign image colors phase' is taking all the time it seems.

But I seem to have been able to switch to PNGs, which I now understand are lossless.

Code: Select all

$ time convert -monitor +dither -map pattern:gray50 test_tiff.tiff out.gif
Load image: 100%
Load image: 100%
Classify image colors: 100%
Assign image colors: 100%
Save image: 100%

real    0m1.005s
user    0m0.838s
sys     0m0.111s

-----

time convert -monitor  test_tiff.tiff out.png

$ time convert -monitor  test_tiff.tiff out.pngLoad image: 100%

real    0m0.567s
user    0m0.496s
sys     0m0.062s

Re: Very Slow TIFF->GIF conversion

Posted: 2007-08-30T18:45:20-07:00
by anthony
PNG also does not use a color pallette unless PNG8 is used, or the image was already given a colormap.