Reputation: 14324
I am trying to find a way to convert an SVG image to either an EPS file or a PDF file using Magick.NET.
Magick.NET is the only library I have found which claims to offer what I need. I have created a console app and added the Magick.NET Nuget package. This is the code for the conversion, as you can see it's extremely simple:
class Program
{
static void Main(string[] args)
{
using (var image = new MagickImage("bread.svg"))
{
image.Write("bread.eps");
}
}
}
It runs fine, and it creates the EPS file. However, when I open the EPS file it is clearly a raster image! Exactly the same happens if I convert it to a PDF. For some reason Magick.NET is turning the SVG into a raster image, and THEN drawing it in an EPS file.
This seems like it can't be right, after all what would be the point in that?!
Does anyone know if this is just how Magick.NET behaves or if I am missing some obscure option or something?
Edit
In the end I decided to CloudConvert's API for doing this conversion.
Upvotes: 0
Views: 1930
Reputation: 8153
The output created by ImageMagick/Magick.NET will always be rasterized. When an image is read by the library it will first convert the image to an internal raster format. This means that all the vector information is gone. When ImageMagick is being used under Linux there is however a plugin that will allow you to convert the internal image into a vector format. This is done with the autotrace library. But due to GPL license used by this library it is not included in Magick.NET
Upvotes: 1