ImageMagick display takes an *astonishingly* long time to di

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Hubbitus
Posts: 66
Joined: 2010-05-04T10:50:21-07:00
Authentication code: 8675308
Location: Russia, Saint-Petersburg

ImageMagick display takes an *astonishingly* long time to di

Post by Hubbitus »

Hello.

Could you please look at https://bugzilla.redhat.com/show_bug.cgi?id=1006865 ?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.)
snibgo's IM pages: im.snibgo.com
Hubbitus
Posts: 66
Joined: 2010-05-04T10:50:21-07:00
Authentication code: 8675308
Location: Russia, Saint-Petersburg

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

Post by Hubbitus »

Reproduce images uploaded. Please look at.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
Hubbitus
Posts: 66
Joined: 2010-05-04T10:50:21-07:00
Authentication code: 8675308
Location: Russia, Saint-Petersburg

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

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
Hubbitus
Posts: 66
Joined: 2010-05-04T10:50:21-07:00
Authentication code: 8675308
Location: Russia, Saint-Petersburg

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

Post by Hubbitus »

Could we do with that something?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.)
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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?
Post Reply