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)