Disable anti-aliasing when generating images


#1

I am trying to generate images from some pdf files. The generated rasterized images have anti-aliasing. How can I turn it off?


Issue with Joining documents using Aspose.PDF
#2

@sbwos

Thank you for contacting support.

Would you please share source and generated ZIP files along with SSCCE code so that we may investigate and assist accordingly. Before sharing requested data, please ensure using Aspose.PDF for .NET 19.10.


#3

Here is a cleaned code example:

Document doc = new Document(docPath);
using (MemoryStream imageStream = new MemoryStream())
{
  Resolution imageResolution = new Resolution(300);
  PngDevice pngDevice = new PngDevice(imageResolution);
  pngDevice.RenderingOptions.InterpolationHighQuality = true;
  pngDevice.Process(doc.Pages[1], imageStream);
  new Bitmap(imageStream).Save(savePath);
}

My example document is page size A0 (52.79 x 37.59in) and I am using 300 as resolution (assuming a single value represents DPI), the generated image has a resolution of 3959 x 2819 pixels which is much smaller than the image generated by other tools and services. 300 DPI for my document size should be ~16000 x 11200 pixels. I would have to deal with this later but more importantly, the image generated by Aspose has anti-aliasing which softens the edges (fonts, vectors, etc.) making it difficult to process them further in our case. Here is a zoomed-in example image:

anti-aliasing.png (494.1 KB)


#4

@sbwos

We are afraid that the API does not currently support disabling anti-aliasing. However, a ticket with ID PDFNET-43642 is logged in our issue management system. We will let you know once any update will be available in this regard.