Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Transparency lost converting eps to png via Magick.NET when ImageMagick source works perfectly

$
0
0
A)

You should set the colorspace and density before your read the file to get the correct result. You are also doing that on the command line. You can do this with the MagickReadSettings class. Below is an example.
MagickReadSettings settings = new MagickReadSettings();
settings.ColorSpace = ColorSpace.RGB;
settings.Density = new MagickGeometry(72, 72);

using (MagickImage image = new MagickImage("93eaeccc-fcd8-4ef1-bb46-08279a5c881a.eps", settings))
{
  image.Format = MagickFormat.Png;
  byte[] bytes = image.ToByteArray(); // No need to write to a stream first.using (FileStream fs = File.OpenWrite("93eaeccc-fcd8-4ef1-bb46-08279a5c881a.png"))
  {
    fs.Write(bytes, 0, bytes.Length);
  }
}
B) and C)

Magick.NET does not use the console version of ImageMagick it calls the methods that will be called by convert.exe directly. The methods that are used by convert.exe are compiled into the Magick.NET library. Most methods and properties have the same name as their command line equivalent to make it easier to change a command line command into C# code.

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>