We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issues with redaction of bitonal images

The redaction annotations work well for me in general, but there are issues when annotating bitonal images (typically PDFs generated from a scanner). It appears that when a redaction is applied onto a bitonal image, the resulting image is always re-encoded in colour (even when the annotation itself is simply black or white), which has the following serious issues:

  1. Increases file size - typically the redacted files are somewhere between 4 and 10 times the size of the original.

  2. Takes a long time - the re-encoding takes significant CPU time, often 5-10 seconds

  3. Reduces quality - the original bitonal image is compressed in a non-lossy way, but the redacted version suffers from JPEG compression artefacts.

Reproduction code is as follows:

  Aspose.Pdf.License license = new Aspose.Pdf.License();
  license.SetLicense("Aspose.Pdf.lic");

  Document pdf = new Document("bitonal.pdf");
  RedactionAnnotation ra = new RedactionAnnotation(pdf.Pages[1], new Aspose.Pdf.Rectangle(100, 500, 200, 600));
  ra.FillColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Black);
  pdf.Pages[1].Annotations.Add(ra);
  ra.Redact();

  pdf.Save("redacted.pdf");

(Note that it is important to use a licensed version to reproduce, because in eval mode the redactions are not fully applied, and the issue does not occur)

I’ve attached sample input and output files. Note that the input file is 58kb and the output 241kb, and if you zoom in close on the output file you’ll see the compression artefacts.

Many thanks for any help you can provide.

George

bitonal.pdf (57.7 KB)
redacted.pdf (240.3 KB)

@GeorgeH

Thanks for contacting support.

We were able to notice the issue(s) which you have mentioned with Aspose.PDF for .NET 18.12 and logged them under the ticket ID PDFNET-45836 in our issue tracking system. We will further investigate the logged ticket in details and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.