Page 1 of 1

Large image dimension causes slow dithering

Posted: 2017-05-01T07:52:08-07:00
by Jason S
I think it's the dither operation that's very slow when I create certain images with one very large dimension. The time it takes seems to be exponential (correction: quadratic) based on image's larger dimension, and jumps way up at each power of 2(?). Maybe there is a legitimate reason for this, but I'm reporting it because it seems wrong.

Steps to reproduce:

Code: Select all

$ convert logo: -resize '640x1!' -resize '32767x1!' test32767.ppm
$ convert logo: -resize '640x1!' -resize '32768x1!' test32768.ppm

$ time convert test32767.ppm test.pbm
real	0m11.681s
user	0m8.664s       ←
sys	0m0.056s

$ time convert test32768.ppm test.pbm
real	0m36.347s
user	0m32.996s      ←
sys	0m0.068s

$ time convert test32768.ppm +dither test.pbm
real	0m0.087s
user	0m0.020s       ←
sys	0m0.012s

$ convert -version
Version: ImageMagick 7.0.5-5 Q16 x86_64 2017-05-01 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP 
Delegates (built-in): jng jpeg png zlib

Re: Large image dimension causes slow dithering

Posted: 2017-05-01T08:43:30-07:00
by snibgo
You may find that FloydSteinberg gives as good results as Riemersma, as is much faster.