This project has moved. For the latest updates, please go here.

Why not set background when convert SVG to PNG?

Aug 16, 2013 at 2:11 AM
Hi all. I not set background when convert image from SVG to PNG? Why?
Thanhks.
Coordinator
Aug 16, 2013 at 6:11 AM
Can you please post some example code so I can see what you are trying to do? Are you using the build in SVG engine of ImageMagick or are you using something like InkScape as a delegate?
Aug 20, 2013 at 2:14 AM
Edited Aug 20, 2013 at 2:14 AM
dlemstra wrote:
Can you please post some example code so I can see what you are trying to do? Are you using the build in SVG engine of ImageMagick or are you using something like InkScape as a delegate?
Code here:
MagickReadSettings settings = new MagickReadSettings();
using (MagickImage image = new MagickImage(@"D:\chart_ef0053f3-d40c-483d-b93d-0b7632fd27a6.svg", settings))
{
       image.BackgroundColor = new MagickColor(255,255,255);
       image.Write(@"D:\chart_ef0053f3-d40c-483d-b93d-0b7632fd27a6.png");
}
Coordinator
Aug 20, 2013 at 5:52 AM
Can you provide me with a link to your input image?
Aug 20, 2013 at 8:10 AM
dlemstra wrote:
Can you provide me with a link to your input image?
OK. Input image SVG: http://v1.cloudgis.vn/gClient/API/resources/chart_ef0053f3-d40c-483d-b93d-0b7632fd27a6.html
Coordinator
Aug 20, 2013 at 12:17 PM
It seems that ImageMagick ignores the opacity in this line:
<rect id="ext-gen1275" opacity="0" stroke="none" fill="#000" height="100%" width="100%"></rect>
I don't know why this is happing but I will try to figure that out later.
Aug 21, 2013 at 2:16 AM
OK. Thanks dlemstra !
Coordinator
Aug 21, 2013 at 7:54 AM
I can confirm this is a bug in ImageMagick and it will be fixed in the next release of Magick.NET.