I'm trying to use Magick.NET to convert an EPS file into a PNG. I've stripped this down to a simple convert, no other options, and Magick.NET still seems to fail at it, while ImageMagick at the command line does it as expected.
Every EPS file I try to convert, no matter its dimensions, ends up at 612 x 792 px. If the EPS fit into those dimensions, there is no improper cropping. Otherwise, it's cropped at those dimensions.
There is only one artboard (bounding box) per EPS, each I've tested are a little different from each other, but they all end up the same: 612 x 792, improper cropping.
var file = fuImageUpload.UploadedFiles[0]; // An EPS provided by UploadControl.
var path = @"C:\_test\";
var fileName = "result.png";
using (MagickImage img = new MagickImage(file.FileBytes))
{
img.Write(Path.Combine(path, fileName));
}
Real simple test. If I try to read img.Width or img.Height (or BaseWidth or BaseHeight) then I get the 612 x 792 dimensions in the code. If I _do_ try to use Resize() on the image, it works, but the crop is still wrong. I've ruled out the upload control as well; I can just point directly to a test EPS file on the drive and the results are the same as using the upload control.
If I run the "same" thing with the ImageMagick command line, it works fine:
magick.exe convert c:\test\test.eps c:\test\result.png
No problems, no cropping there. Resizing works just as well on command line too.
GhostScript 9.27 is installed. ImageMagick 7.0.8-58-Q16 installed.
Can you share an EPS file that I can use to reproduce this issue? It is possible that this bug has been fixed in ImageMagick but not in Magick.NET but I really need a file to investigate this. Feel free to email me if you cannot share it in public.
Very much appreciated Dirk. The file I've been using is a company logo that I'd prefer not to share, but I'm getting the same result from this test file (attached). EPS and resulting PNG image contained.
I can confirm this was a bug inside ImageMagick. Will need to publish a new release of Magick.NET to resolve this issue.
I'll keep my eye out for it, thanks again Dirk!