Page 2 of 2

Re: SVG to JPG conversion issue

Posted: 2009-02-05T11:41:42-07:00
by magick
Try this command:
  • convert -stroke white a.svg -depth 8 b.png

Re: SVG to JPG conversion issue

Posted: 2009-02-10T05:47:25-07:00
by abp
Try this command:

convert -stroke white a.svg -depth 8 b.png
It works! But sadly only for the single image. The other SVGs containing semi-transparency in the batch I'm trying to process contains heaps of artifacts after using the -stroke parameter. Is there a more general approach I can take to fix the issue? Is my problem something that will be accommodated in future imagemagick releases?

Thanks for you time

Re: SVG to JPG conversion issue

Posted: 2009-02-10T18:24:53-07:00
by anthony
abp wrote:I'm having a similar problem via opacity in a SVG to PNG convertion. I'm calling:

Code: Select all

convert -alpha on -depth 8 -background none -resize 100.0%!x100.0%! a.svg b.png
The output renders semi transparency as fully opaque black several places!?!?!
I tried this with my RSVG version of ImageMagick (latest version), but I cleaned up your command so that the order made sense. The -resize does nothing, and the depth is not needed. Added a -density to see a enlarged rendering.

Code: Select all

convert -density 300 -background none a.svg b.png
Result was fine. semi-transparency was good. no black background.

Changing this to use the internal MSVG method...

Code: Select all

convert -density 300 -background none MSVG:a.svg  b.png
that also worked though the semi-transparency did not shade properly (understandable as it is incomplete) but it came out quite well.

Re: SVG to JPG conversion issue

Posted: 2009-02-11T06:34:01-07:00
by abp
I tried this with my RSVG version of ImageMagick (latest version), but I cleaned up your command so that the order made sense. The -resize does nothing, and the depth is not needed. Added a -density to see a enlarged rendering.

Code:
convert -density 300 -background none a.svg b.png


Result was fine. semi-transparency was good. no black background.
Tried your approach but still get artifacts. Using the below source and getting below results.

Source:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 width="27px" height="27px" viewBox="0 0 27 27" enable-background="new 0 0 27 27" xml:space="preserve">
<rect x="2.0039063" y="0.9941406" opacity="0.22" width="23" height="1"/>
<rect x="3.0039063" y="21.9941406" opacity="0.22" width="21.0019531" height="1"/>
<rect x="2.0043945" y="22.9941406" opacity="0.2" width="23.0004883" height="1"/>
<rect x="2.0043945" y="23.9941406" opacity="0.15" width="23.0004883" height="1"/>
<rect x="1.0043945" y="24.9941406" opacity="0.08" width="25.0004883" height="1"/>
<rect x="2.0039063" y="1.9941406" opacity="0.15" width="1" height="21.0019531"/>
<rect x="1.0039063" y="1.9941406" opacity="0.08" width="1" height="23.0019531"/>
<rect x="24.0039063" y="1.9941406" opacity="0.15" width="1" height="21.0019531"/>
<rect x="25.0039063" y="1.9921875" opacity="0.08" width="1" height="23.0019531"/>
<rect x="3.0039063" y="1.9785156" opacity="0.95" fill="#FFFFFF" width="21" height="20"/>
<rect x="2.0039063" y="-0.0058594" opacity="0.03" width="23" height="1"/>
<polygon opacity="0.03" points="1.0039063,4.0019531 1.0039063,25.9570313 25.9960938,25.9570313 25.9960938,3.9863281 
	26.9960938,3.9863281 26.9960938,27.0019531 0.0039063,27.0019531 0.0039063,4.0019531 "/>
</svg>
Should look like:
Image

Looks like (with latest imagemagick v.6.4.9-2-Q16)
Image

Seems like the semitransparent anti aliasing pixels of the separate <rect> elements are overlapping resulting in 'dark' areas. Maybe a simple alpha blending problem?

Any ideas?

Re: SVG to JPG conversion issue

Posted: 2009-02-16T08:02:28-07:00
by abp
ImageMagic version ImageMagick-6.4.9-4 solved the problem, Thanks