EPS为JPEG,质量较差

时间:2018-06-25 19:08:46

标签: c# magick.net

我正在使用Magick.NET使用以下代码将EPS文件导出为JPEG:

MagickReadSettings settings = new MagickReadSettings();
settings.ColorSpace = ColorSpace.sRGB;
settings.Format = MagickFormat.Eps;

using (MagickImage _image = new MagickImage())
{
    _image.Read(image.Path, settings); //Loading the EPS
    _image.Resize(3000, 3000); //The max size will be 3000px
    _image.Density = new Density(300); //Setting DPI = 300
    _image.Write("teste.jpg"); //Saving the EPS
}

结果太差了,我不知道为什么。使用_image.Write之前需要配置一些东西吗? 通过Photoshop导出和Magick.NET导出查看结果:

Photoshop(2167x2322 300dpi):

enter image description here

Magick.NET(2800x3000 300dpi):

enter image description here

EPS文件的链接:https://ufile.io/hhokl

1 个答案:

答案 0 :(得分:2)

要获得高质量,必须先设置文件配置,然后再通过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");
}

新结果: enter image description here