Rending high dpi svg then downsampling - sensible?

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
moocow89
Posts: 1
Joined: 2018-01-16T16:00:03-07:00
Authentication code: 1152

Rending high dpi svg then downsampling - sensible?

Post by moocow89 »

Hi,

I've programatically generated a 60 meg SVG file and am using IM to render it to PNG with the intent of ultimately getting it professionally printed. The generated image pretty much entirely consists of fine lines at all angles.

If I render at a density of 300 (using SVG shape-rendering:crispEdges to disable anti-aliasing) the fine-line jaggies are clearly visible and look ugly.
If I render with "shape-rendering:geometricPrecision" this allows anti-aliasing but the image is unpleasantly blurred.

I've been trying rendering at a high dpi (1800 with svg:crispEdges) and then resampling the resultant png back down to 300, with the hope that IM will do a better job this way than any permutation of straight rending at 300. The generated images appear better to me - but is it a sensible approach? Is there more I could do to improve the final 300dpi output? (for example, I'm noticing moire patterns to a greater or lesser extent depending upon the density I use - is there any way to avoid those?)

(as an aside, I'm really impressed with the power of IM - a big thank you for all the hard work that's gone into it)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Rending high dpi svg then downsampling - sensible?

Post by fmw42 »

try

Code: Select all

convert -density 1800 image.svg -resize WxH image.png
where WxH is your desired PNG dimensions. This is a typical process for converting SVG to raster format. The density must come before reading the svg.
Post Reply