convert svg to jpg, rotation artefacts

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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert svg to jpg, rotation artefacts

Post by fmw42 »

try setting the -virtual-pixel to white. see http://www.imagemagick.org/Usage/distorts/affine/


you can also try using -distort SRT to do the transform with rotation and xscale and yscale.

see http://www.imagemagick.org/Usage/distorts/#srt

you can also change the interpolation to have more or less smoothing/antialiasing

and you can control the virtual-pixel setting for the edge interpolation
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: convert svg to jpg, rotation artefacts

Post by magick »

ImageMagick has two SVG renderer. Type
  • identify -list configure
Is rsvg associated with the DELEGATES tag? To use the internal renderer use this command:
  • convert msvg:test.svg res.jpg
The conversion worked fine for us (no outline). We're using ImageMagick 6.5.3-7.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: convert svg to jpg, rotation artefacts

Post by anthony »

Looks like it may be a problem in IM's call of the RSVG library.

Internal MSVG converter works fine

Code: Select all

   convert msvg:t.svg show:
But no attempt at using the rsvg converter from "convert" has worked.

however using the rsvg commands

Code: Select all

  rsvg-convert t.svg > t.png
  convert t.png -background white -flatten show:
also works fine!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: convert svg to jpg, rotation artefacts

Post by magick »

Try this command:
  • convert -background none svg_img_ex.svg svg_img_ex.png
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: convert svg to jpg, rotation artefacts

Post by anthony »

I tried

Code: Select all

convert -background none svg_img_ex.svg  -background white -flatten show:
And I still get the 'black halo' bug along the edges, that the user is complaining about.
I do not get that using the rsvg-convert command.

Note the image in the SVG is svg_img_ex.gif.jpeg that is a jpeg image.

After converting the JPEG to GIF

Code: Select all

  convert svg_img_ex.gif.jpeg  -matte svg_img_ex.gif
and fixing the image reference link in the SVG
I still get same 'black halo' along edges bug
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply