Optimizing PDF document containing image inverts black and white

Hi,

Starting from Aspose.PDF 24.3 optimizing (i.e. resizing and compressing images) a PDF document containing a TIFF image inverts black and white resulting in a page with a black background.

I managed to reproduce this with this program. Running it with Aspose.PDF 24.2 gives proper output (see attached out.24.2.pdf). Running it with Aspose.PDF 24.3 or later (up to 24.9) gives inverted output (see out.24.3.pdf).

using Aspose.Pdf;
using Aspose.Pdf.Optimization;

using (var stream = File.Open("in.pdf", FileMode.Open))
{
    var document = new Document(stream);

    var options = new OptimizationOptions();
    options.ImageCompressionOptions.CompressImages = true;
    options.ImageCompressionOptions.ImageQuality = 50;   
    options.ImageCompressionOptions.ResizeImages = true;

    document.OptimizeResources(options);
    document.Save("out.pdf");
}

Please note, this behavior is only seen on some TIFF images (as enclosed). I’ve also seen TIFF images thar are being optimized without problems.

in.pdf (66.5 KB)

out.24.2.pdf (60.0 KB)

out.24.3.pdf (60.0 KB)

@RaimonddeLange
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-58225

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.