Mobile app version of vmapp.org
Login or Join
Vandalay110

: How to rasterize an SVG without anti-aliasing I've made a map in inkscape and now need to change it to a bitmap or .png. The map will be interpreted by a computer program which will look

@Vandalay110

Posted in: #AntiAliasing #Inkscape #Raster #Svg #Vector

I've made a map in inkscape and now need to change it to a bitmap or .png. The map will be interpreted by a computer program which will look for exact colors so the edges need to be crisp. when I export a .png with inkscape, use an online file converter or even take a screenshot it is always anti-aliased. help.

10.04% popularity Vote Up Vote Down


Login to follow query

More posts by @Vandalay110

4 Comments

Sorted by latest first Latest Oldest Best

 

@Smith574

You can also use SVG's shape-rendering property to make edges crisp.

In SVG XML that looks like:

<svg:something shape-rendering="crispEdges" ... />


In Inkscape's UI you can set this manually using the XML Editor (Ctrl+Shift+X) as shown in this screenshot:



Select the node that the property should apply to. Here I am applying it to a group of paths. The property is displayed on the right. To add it, replicate the text you see in the lower right corner, then press Set.

10% popularity Vote Up Vote Down


 

@Chiappetta793

Inkscape 0.91 and above has the ability to toggle antialiasing. This can be accessed through the Document Properties window (Shift+Ctrl+D). When turned on, which is the default, this image of an array of triangles looks like this.



When turned off the image looks smoother.



As others have mentioned, this currently has no effect on the png export. Antialiasing is still turned on and the gaps between the triangles still visible.

What Inkscape is doing when you disable antialiasing is adding shape-rendering="crispEdges" to the file. Open your SVG in a text editor and look somewhere around line 19 and you should see it.



Luckily, this tag is read and adhered to when importing the SVG into GIMP. GIMP can import an SVG and set the import resolution, meaning that you can scale your png on import to be your desired size. It will crop it to the page boundaries.



You can now save the image and antialiasing will be disabled.



This has been reported as a bug a couple of times:

bugs.launchpad.net/inkscape/+bug/947660 https://bugs.launchpad.net/inkscape/+bug/180612

10% popularity Vote Up Vote Down


 

@Kristi927

One simple solution is to export to PDF, and then use Ghostcript on the resulting PDF. Using a strawberry image from Openclipart and the command

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m
-r72 -dGraphicsAlphaBits=1
-sOutputFile=image.png image.pdf


I get the following result.




If your image also includes text, you’ll need to add -dTextAlphaBits=1 too. Change the -r72 to a different value to rescale the image.

10% popularity Vote Up Vote Down


 

@Gail6891361

The development version of Inkscape (upcoming 0.91 release) has a global anti-aliasing toggle in the Document Properties window, which should also work for export. Look for "Development Versions" on the download page:
www.inkscape.org/en/download/

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme