ImageMagick SVG rasterizing problem

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Whiles

ImageMagick SVG rasterizing problem

Post by Whiles »

I have a problem rasterizing SVG images:
http://chembook.org/doc/Immagine:Hazard_E.svg
As you can see, rasterized version is different from the native SVG ( http://chembook.org/w/images/Hazard_E.svg ).
Why? It seems to not consider border bends.
I taken the image from http://upload.wikimedia.org/wikipedia/c ... zard_E.svg , and here ( http://wikimediafoundation.org/wiki/Image:Hazard_E.svg ) it works well.

Is this a ImageMagick bug?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ImageMagick SVG rasterizing problem

Post by fmw42 »

Maybe my eyes are bad, but I don't see any differences on IM 6.4.1-10 Q16. What version of IM are you using?

Never mind, I see the difference when alternating the images in the display. The black area in the lower left is more rounded than in your http://chembook.org/doc/Immagine:Hazard_E.svg version.
Whiles

Re: ImageMagick SVG rasterizing problem

Post by Whiles »

fmw42 wrote:Maybe my eyes are bad, but I don't see any differences on IM 6.4.1-10 Q16. What version of IM are you using?

Never mind, I see the difference when alternating the images in the display. The black area in the lower left is more rounded than in your http://chembook.org/doc/Immagine:Hazard_E.svg version.
phpinfo(): http://chembook.org/w/phpinfo.php#module_imagick
ImageMagick version: ImageMagick 6.2.4 02/10/07 Q16 http://www.imagemagick.org
Whiles

Re: ImageMagick SVG rasterizing problem

Post by Whiles »

Ah, another thing: I installed the lastest version of ImageMagick on local and the problem is the same:
Image

But with firefox this SVG image is different (as you said the black area in the lower left is more rounded).
Why? :(
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ImageMagick SVG rasterizing problem

Post by anthony »

Why is your rasterized image in SVG vector image format?
That does not make any sense!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Whiles

Re: ImageMagick SVG rasterizing problem

Post by Whiles »

anthony wrote:Why is your rasterized image in SVG vector image format?
That does not make any sense!
Why? What should I use? :?

I don't understand what you mean.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ImageMagick SVG rasterizing problem

Post by anthony »

SVG is a vector image format, saving IM rendered images in it is equivelent to saving it into a JPG or PNG format with a SVG wrapper around it. You are better off using such a format directly, rather than saving in back into a SVG.

See A Word about Vector Image formats
http://imagemagick.org/Usage/formats/#vector
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Whiles

Re: ImageMagick SVG rasterizing problem

Post by Whiles »

anthony wrote:SVG is a vector image format, saving IM rendered images in it is equivelent to saving it into a JPG or PNG format with a SVG wrapper around it. You are better off using such a format directly, rather than saving in back into a SVG.

See A Word about Vector Image formats
http://imagemagick.org/Usage/formats/#vector
I want to use it on MediaWiki, do you know how mediawiki works?

If i write [[Image:lol.svg|5000px]] MediaWiki software will rasterize lol.svg to png and show it in the page without loss of quality.
If i use one png image the quality loss is very high.

So I need SVG and I can't wrap it around...
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ImageMagick SVG rasterizing problem

Post by anthony »

Then IM is not for you. IM is designed as a raster image processor, not a vector processor. Once rasterized it will be like PNG, best at a specific scale or resolution.

When IM outputs to SVG or a vector it is basically a wrapper around the raster image it generated.

There are seom vector to vector processors, and I even look at a raster to vector program called "AutoTrace", which attempts to convert a raster i mage to SVG or similar format without too much pixelization. See http://imagemagick.org/Usage/transform/#edge_vector for an example of this, where I use it to generate a smooth line drawing of a raster shape.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply