I am trying to convert a .tif to a .png image and resizing it down to 1000 pixels wide. The original image is a scanned text document of 2480x 3507 and I use the resize command on it after reading it in. The resultant image has missing pixels and it seems that anti-aliasing is not working for this.
I tried the sample command as well which works much better than the resize but still some pixels get destroyed. I am using the following code :-
I am using the latest 6.8.9.401 Q16 x64 version of the Magick.NET.
Thanks
I tried the sample command as well which works much better than the resize but still some pixels get destroyed. I am using the following code :-
MagickReadSettings settings = new MagickReadSettings();
settings.Density = new MagickGeometry(150, 150);
// Read the PDF into a collection of images
images.Read(currentDocument.OriginalPath, settings);
foreach (MagickImage image in images)
{
// Formatting image
image.Format = MagickFormat.Png;
image.Alpha(AlphaOption.Remove);
if (image.BaseWidth > image.BaseHeight)
{
//image.Resize(1000, 0);
image.Sample(1000, 0);
}
else
{
//image.Resize(0, 1000);
image.Sample(1000, 0);
}
image.Quality = 100;
image.Annotate("Some Watermark", Gravity.Southwest);
// Write the image to the specified path as a PNG
image.Write("test.png");
}
Am I missing something in this?I am using the latest 6.8.9.401 Q16 x64 version of the Magick.NET.
Thanks