Page 1 of 1

SVG + wand-py + ImageMagick "scaling" issue.

Posted: 2013-10-08T15:03:50-07:00
by streetlogics
I have detailed my issue on StackOverflow - http://stackoverflow.com/questions/1925 ... ling-issue , so if you are a member / want some points and know the answer, feel free to post there, otherwise I'll keep an eye out here. Here are the details:

I'm using wand-py (0.3.3) and ImageMagick(versions below) in an application to customize designs from source SVGs. I'm currently running into an issue with different versions of ImageMagick returning rather different results, and I'm hoping somebody out there in Python / django land has an idea.

The source svg looks like this:
Image

Using ImageMagick 6.6.2-6 2012-08-17 Q16, the cropped / slightly scaled output looks like this (not perfect, but not terrible):
Image

However, using ImageMagick 6.6.9-7 2012-08-17 Q16, the output looks like this:
Image

The actual call I'm making is simply:

Code: Select all

with WandImage(blob = self.cover_binary, resolution = 300) as img:
    img.type = self.png_image_type #truecolor
    img.depth = self.png_image_depth #8
    img.resize(self.png_width, self.png_height)
    self.png_output = img.make_blob('png')
I've tried tons of variations of img.resize() with different blur and filter settings, (blur values between 0 and 1, filter values of none, triangle, point, lanczos, lanczossharp), but I'm just not able to get the preview rendering with the small line detail. I'm at my wits end and about to go with a solution that I don't like, and am hoping somebody out there might be able to give me some insight on what I'm missing here. It already took me a few hours just to realize that ImageMagick is the culprit since that's literally the only thing different between my local box running the older version and the staging box that has the newer version, and I've spent more than a few hours now tinkering with different settings and going through my workflow to re-render things (which takes ~30-60 seconds each time).

Re: SVG + wand-py + ImageMagick "scaling" issue.

Posted: 2013-10-08T15:22:42-07:00
by fmw42
try setting the equivalent of -filter point and -interpolation nearestneighbor with -resize.

or probably better (supersampling method)

set the svg density 4 times larger, then resize by 1/4 ( note you need to set the density before reading the svg file)

If that fails perhaps you should provide a link to the original svg file