I am new to imageMagick and am using it to convert a PDF shipping label into a PNG but am losing the resolution on the barcode. How can I increase the readability?
Here is the snippet of the imageMagick commands I am using:
img.Resize(new MagickGeometry(800,0));
img.Threshold((Percentage) 60);
img.Write(outputPng);
Here is a screenshot of the actual PDF I converted from
UPDATE Here is the revised snippet that works and gets me a darn near 1-to-1 resolution:
var settings = new MagickReadSettings {Density = new Density(200)};
using (var images = new MagickImageCollection())
{
images.Read(inputPdf, settings);
using (var img = images.AppendVertically())
{
img.Density = new Density(150);
img.Trim();
img.Quality = 72;
img.Sharpen(0, 1.0);
img.ColorType = ColorType.Bilevel;
img.Depth = 1;
img.Alpha(AlphaOption.Off);
img.Write(outputPng);
}
}