turn off antialias on svg export

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
whiskybar

turn off antialias on svg export

Post by whiskybar »

I have been unable to turn off antialiasing when converting SVG to PNG. Is the following line correct?

Code: Select all

convert +antialias drawing.svg drawing.png
The source svg is a very simple image created with inkscape: http://lurkingideas.net/media/drawing.svg.

If you look at the result png image http://lurkingideas.net/media/drawing.png, it is still anti-aliased. It should contain two or three colors but there are 414 colors instead.

What am I missing here?

Thank you very much
Jiri
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: turn off antialias on svg export

Post by fmw42 »

don't know much about SVG, but have you tried putting +antialiasing after the input svg file?
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: turn off antialias on svg export

Post by el_supremo »

The drawing.svg file gives a 404 Not Found error

Pete
whiskybar

Re: turn off antialias on svg export

Post by whiskybar »

fmw42: good idea. I just tried that but it didn't work either though.

el_supremo: sorry about the 404. I have fixed that.

I was wondering if you got the same result - the same PNG. It is anti-aliased, isn't it? Is it correct behavior? What should +antialias do if not prevent this from happening?

Jiri
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: turn off antialias on svg export

Post by anthony »

+antialias should be given BEFORE reading the SVG file.

What result (and how good it is) you get depends on if your IM was built to use the RSVG delegate library or the internal MSVG processing.

See IM examples, drawing, SVG Handling for more details of RSVG and MSVG
http://www.imagemagick.org/Usage/draw/#svg

Hey did you know that if you compile the latest IM with the autotrace development library installed, IM can generate SVG from raster images???? Of course the image should be as large as posible and preferable simplified to reduce shapes and colors.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
whiskybar

Re: turn off antialias on svg export

Post by whiskybar »

anthony, a spot-on explanation

This also explains why the PNG created by the rsvg utility were the same as if they were created by IM. Thank you very much for your answer.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: turn off antialias on svg export

Post by anthony »

whiskybar wrote:This also explains why the PNG created by the rsvg utility were the same as if they were created by IM. Thank you very much for your answer.
The RSVG library delegation is used as it is a more correct implementation of the SVG drawing, where the MSVG converts SVG to MVG drawing methods.

Unfortunately MVG does not have the color gradient handling added to it as yet, though it is supposed to only need the appropriate linking in.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply