Page 1 of 1

Drawing on bilevel PNG is (very) slow

Posted: 2013-09-16T03:57:50-07:00
by myicq
Related to my previous post (viewtopic.php?f=1&t=24069), I am making experiments with annotation and drawing on the image.

In principle all works. But as soon as I work with monochrome (bilevel) images, ImageMagick becomes extremely slow. I have an Intel i7, Win7 yet drawing a straight line in a 48000 x 1200 pixel bilevel PNG still takes the better part of 30 seconds.

This will take a second or two and creates a 4bpp PNG

Code: Select all

convert -size 48000x1200 xc:white -fill black -stroke black -strokewidth 50 -draw "line 0,0 1000,300" normal.png
This takes around 30 seconds:

Code: Select all

convert normal.png -type bilevel  mybilevel.png
What can I do to speed up drawing ? Happy to try everything.

Re: Drawing on bilevel PNG is (very) slow

Posted: 2013-09-16T05:10:49-07:00
by snibgo
Your first command reduces the staircase effect of diagonal lines with carefully-selected shades of gray, known as "antialiasing". Your second command then carefully removes all the grey.

Both commands run much faster if you don't create the grey in the first place. Turn off antialiasing by placing "+antialiasing" at the start of the first command.

Re: Drawing on bilevel PNG is (very) slow

Posted: 2013-09-16T05:56:32-07:00
by magick
You can try one of the threshold options. They are lightening fast (e.g. -threshold).

Re: Drawing on bilevel PNG is (very) slow

Posted: 2013-09-16T11:48:36-07:00
by snibgo
Another thing: you may find that Q8 is quicker than Q16.