- convert -stroke white a.svg -depth 8 b.png
SVG to JPG conversion issue
Re: SVG to JPG conversion issue
Try this command:
Re: SVG to JPG conversion issue
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?Try this command:
convert -stroke white a.svg -depth 8 b.png
Thanks for you time
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: SVG to JPG conversion issue
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.abp wrote:I'm having a similar problem via opacity in a SVG to PNG convertion. I'm calling:
The output renders semi transparency as fully opaque black several places!?!?!Code: Select all
convert -alpha on -depth 8 -background none -resize 100.0%!x100.0%! a.svg b.png
Code: Select all
convert -density 300 -background none a.svg b.png
Changing this to use the internal MSVG method...
Code: Select all
convert -density 300 -background none MSVG:a.svg b.png
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: SVG to JPG conversion issue
Tried your approach but still get artifacts. Using the below source and getting below results.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.
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>
Looks like (with latest imagemagick v.6.4.9-2-Q16)
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
ImageMagic version ImageMagick-6.4.9-4 solved the problem, Thanks