TIFF to PDF Colour Distortion

Hi


I’ve got a very simple TIFF image that I’m using to test the Aspose TIFF to PDF conversion. As you can see, the original image is green with white text and a purple border. In the resulting PDF the colours are very different.

I’m enclosing both the TIF and the resulting PDF.

I’m using aspose-pdf version 11.2.0.

The core part of the code is as follows:

import com.aspose.pdf.Document;
import com.aspose.pdf.Page;
import com.aspose.pdf.Image;

Document doc = new Document();
Page page = doc.getPages().add();
FileInputStream fs = new FileInputStream(fileLocation);
Image image = new Image();
image.setBufferedImage(ImageIO.read(fs));
page.getParagraphs().add(image);
ByteArrayOutputStream baOutputStream = new ByteArrayOutputStream();
doc.save(baOutputStream);

At a later stage I write out the file. The code works fine for other images types (e.g. jpg).

Thanks, Richard

Hi Richard,


Thanks for contacting support.

I have tested the scenario using latest release of Aspose.Pdf for Java 11.3.0 in Eclipse Mars project with JDK 1.8 and I am unable to notice any issue. As per my observations, the image is properly appearing in resultant PDF file (see attached output). For your reference, I have also attached the output generated over my end.

[Java]

Document doc = new Document();<o:p></o:p>

Page page = doc.getPages().add();

java.io.FileInputStream fs = new java.io.FileInputStream("c:/pdftest/example.tif");

Image image = new Image();

// image.setBufferedImage(javax.imageio.ImageIO.read(fs));

// image.setFile("c:/pdftest/example.tif");

image.setImageStream(fs);

page.getParagraphs().add(image);

// java.io.ByteArrayOutputStream baOutputStream = new java.io.ByteArrayOutputStream();

doc.save("c:/pdftest/example_Converted.pdf");

fs.close();