Page 1 of 1

Svg to Jpeg conversion - missing image element

Posted: 2016-01-05T02:34:18-07:00
by eviksza
When I convert SVG file to Jpeg file, some of the embedded images are missing from the converted Jpeg file.

SVG files can contain embedded images in jpeg or png format. I found that during the conversion only embedded images in jpeg format disappear.

Is it a bug, or jpeg images in SVG files are not supported? Is there a workaround for this issue?

I use the latest version of Magick.NET (v7.0.0.0) with .NET 4.5.

I tried to convert this SVG file to Jpeg: ... e-04-t.svg

I use the following code for the conversion:

Code: Select all

MagickReadSettings readSettings = new MagickReadSettings()
    Format = MagickFormat.Svg

using (MagickImage image = new MagickImage(svgFilePath, readSettings))
    image.Format = MagickFormat.Jpeg;

    image.Write(Path.ChangeExtension(svgFilePath, "jpg"));
Thank you in advance!

Re: Svg to Jpeg conversion - missing image element

Posted: 2016-01-05T05:12:46-07:00
by dlemstra
It seems that your .svg file is invalid. The content type for one of the embedded images is 'image/jpg' instead of 'image/jpeg'. I found the following bug report for it: We build our own version of `gdk-pixbuf` under Windows and I just pushed a patch to our repository to also recognize 'image/jpg'. You will be able to read this image in the next version of Magick.NET. I will try to publish that at the end of next month.

Re: Svg to Jpeg conversion - missing image element

Posted: 2016-01-06T03:21:42-07:00
by eviksza
Thank you very much!