Page 1 of 1

ImageMagick display takes an *astonishingly* long time to di

Posted: 2013-09-14T07:12:29-07:00
by Hubbitus
Hello.

Could you please look at https://bugzilla.redhat.com/show_bug.cgi?id=1006865 ?

Re: ImageMagick display takes an *astonishingly* long time t

Posted: 2013-09-14T07:31:40-07:00
by snibgo
It seems no sample SVG is provided, hindering diagnosis. I expect the SVG file specifies a very large number of pixels. A suitable "-density" setting will speed up (or slow down) a rasterisation of an SVG.

(I'm not an official IM person; just a user. This isn't an official response.)

Re: ImageMagick display takes an *astonishingly* long time t

Posted: 2013-09-16T19:33:04-07:00
by Hubbitus
Reproduce images uploaded. Please look at.

Re: ImageMagick display takes an *astonishingly* long time t

Posted: 2013-09-16T19:57:33-07:00
by fmw42
In your fast file, you have width="4379px" height="3630px", which is rather big. But in your slow file you have width="33022px" height="3750px" which is ten times a wide as the fast file. Your svg file is specifying rather large widths and heights, which is likely why they take so long.

convert image.svg show:

seems to display a bit faster than

display image.svg



Also the display time may also have to do with what delegate library you are using to process the svg (MSVG, RSVG or inkscape)

type

convert -list format

and see what you get for SVG

Unfortunately, you do not mention what version of IM or platform you are using.

Re: ImageMagick display takes an *astonishingly* long time t

Posted: 2013-09-16T20:28:28-07:00
by Hubbitus
Thanks for the answer.
But indeed also Chromium open its fast enough.

Code: Select all

$ convert -list format | grep SVG
     MSVG  SVG       rw+   ImageMagick's own SVG internal renderer
      SVG  SVG       rw+   Scalable Vector Graphics (RSVG 2.37.0)
     SVGZ  SVG       rw+   Compressed Scalable Vector Graphics (RSVG 2.37.0)
How I can try change delegator to image display?

Re: ImageMagick display takes an *astonishingly* long time t

Posted: 2013-09-16T20:36:43-07:00
by fmw42
IM relies upon the delegate you are using (RSVG) to convert from vector to pixel. That has nothing to do with the display of the data as far as I know. I expect it is the RSVG delegate that is slow since just using identify (without any display) is just as slow.

Re: ImageMagick display takes an *astonishingly* long time t

Posted: 2013-09-16T23:34:10-07:00
by Hubbitus
Could we do with that something?

Re: ImageMagick display takes an *astonishingly* long time t

Posted: 2013-09-17T00:20:30-07:00
by snibgo
By default, IM creates all the pixels in the SVG file. For boot-slow.svg, this is a large number and takes 65 seconds on my old laptop. If the intention is to display the entire image scaled down to the screen, rendering all the pixels is a waste of time, and specifying a low density will save time and memory:

Code: Select all

convert -density 9 boot-slow.svg b.png
This takes 5 seconds on my laptop.

Software that doesn't want all the pixels would do well to use a low density. It might know the required output size, find how many pixels would be created from the SVG file, and choose an appropriate density. I assume this is what Firefox etc does.

ImageMagick can be used to find the width and height that would be created:

Code: Select all

identify -format "%w,%h" boot-slow.svg
This takes 0.31 seconds on my laptop.

(These tests were on IM v6.8.6-9 on Windows 7, with 4 GB RAM.)

Re: ImageMagick display takes an *astonishingly* long time t

Posted: 2013-09-17T13:11:05-07:00
by fmw42
This will work extremely fast on unix to display an image 512 in the largest dimension (given user snibgo's suggestion)

maxsize=512
density=`convert -ping boot-quick.svg -format "%[fx:72*$maxsize/max(w,h)]" info:`
convert -density $density boot-quick.svg x:

However, my SVG renderer on my Mac OSX IM is producing a mostly black image. Not sure what the issue is?