Confiscate an EPS export to JPEG on Magick.NET

Asked

Viewed 42 times

3

I’m using the library Magick.NET to convert an EPS file > JPEG. However the result is not pleasant because independent of the resolution (DPI) and size(Width and Height) that I put the image comes out pixelated and with the wrong colors... Following example:

Image saved in Photoshop:

inserir a descrição da imagem aqui

Image saved via Magick.NET inserir a descrição da imagem aqui

Because it is a vector, the correct one would be to save it in any dimension quality but that’s not what’s happening. Follow the code I’m using.

using (MagickImage _image = new MagickImage(image.Path))
{
     _image.Resize(3000, 3000); //Maior lado = 3000px
     _image.Density = new Density(300); //Set DPI = 300
     _image.Write("teste.jpeg"); //
}

Is there any setting or parameter that I should pass to improve this color resolution and correction so that it is EQUAL to EPS?

1 answer

3

To have a good quality it is necessary to configure the file before importing it through the MagickReadSettings:

 MagickReadSettings settings = new MagickReadSettings();
 settings.ColorSpace = ColorSpace.sRGB;
 settings.Format = MagickFormat.Eps;
 settings.Compression = Compression.LosslessJPEG;
 settings.Density = new Density(300);

 using (MagickImage _image = new MagickImage())
 {
     _image.Read(image.Path, settings);
     _image.Write("teste.jpg");
 }

New result:

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.