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.
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:
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:
gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m \
-r72 -dGraphicsAlphaBits=1 \
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.
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.
There is a resvg library written in Rust. Part of the project is command line application that would allow you to render SVG as PNG. Said application allows to optimize for speed instead of quality, which generally gives the desired result.
You can execute application as below, as described here by the author.
rendersvg --shape-rendering optimizeSpeed --text-rendering optimizeSpeed --image-rendering optimizeSpeed in.svg out.png
Drawback is - I haven't found any binary release so you must compile it from source.