Conversion to TIFF: setting PhotometricInterpretation tag

Hi Aspose Team!

Is it possible to set the PhotometricInterpretation tag when converting a Word or an Excel document into a TIFF image?

When now using Aspose.Words to convert a Word document or Aspose.Cells to convert an Excel document into a TIFF image (using the CCITT Group 4 compression) the PhotometricInterpretation tag is set to 1 (1 = BlackIsZero). The produced file is legal and conforms the TIFF6 specification but the default image viewer on the Windows XP platform does not interpret this tag properly and displays the picture inverted. Because some of our customers still use Windows XP, we would like to produce TIFF images which would be displayed correctly also in the WinXP image viewer.

I checked the options of these classes:

com.aspose.words.ImageSaveOptions
com.aspose.cells.ImageOrPrintOptions

but neither of the two provides the option to set the PhotometricInterpretation tag.
Thanks for help.

Regards,
Juraj

Hi Juraj,

Thanks for your inquiry. It would be great if you please share
following detail for investigation purposes. I will check this issue at Windows XP.


  • Please attach your input Word document.
  • Please attach the output Tiff file that shows the undesired behavior.

Unfortunately,
it is difficult to say what the problem is without the Document(s) and
simplified application. We need your Document(s) and simple project to
reproduce the problem. As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

Hi Juraj,

Thanks for your posting and using Aspose components.

Regarding Aspose.Cells, please provide us your Excel documents and sample project replicating this issue. Please provide screenshots illustrating this issue. It will help us diagnose this issue.

It could be a new feature request. In this case, we will log it in our database for further investigation and implementation.

Hello Tahir,

I am providing you with the source Word document as well as the output and screenshots from WinXP and Win7:

  • TestDoc.doc - the source document
  • word-to-tiff.tif - the output document
  • word-to-tiff-WinXP-interpretation.png - how the output document is interpreted by the WinXP default viewer
  • word-to-tiff-Win7-interpretation.png - how the output document is interpreted by the Win7 default viewer
Regards,
Juraj

Hello Shakeel,

I am sending you the source document and the output document as well as the interpretation on WinXP and Win7:

  • TestSheet.xls - the source document
  • excel-to-tiff.tif - the output document
  • excel-to-tiff-WinXP-interpretation.png - how the default viewer in WinXP interprets the output document
  • excel-to-tiff Win7-interpretation.png - how the default viewer in Win7 interprets the output document

Here is the sample code which produces the output document:


        byte[] inputData = ...;
        ByteArrayInputStream bais = new ByteArrayInputStream(inputData);

        Workbook book = new Workbook(bais);

        ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
        // Set the image type
        imgOptions.setImageFormat(ImageFormat.getTiff());
        imgOptions.setTiffCompression(com.aspose.cells.TiffCompression.COMPRESSION_CCITT_4);
        imgOptions.setHorizontalResolution(Constants.RESOLUTION);
        imgOptions.setVerticalResolution(Constants.RESOLUTION);

        WorkbookRender wr = new WorkbookRender(book, imgOptions);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        wr.toImage(baos);

        byte[] convertedData = baos.toByteArray();

Regards,

Juraj

Hi Juraj,

Thanks for your files and using Aspose.Cells.

We were able to observe this issue. The default XP viewer shows the tiff image in black color. We found, if you remove this line

imgOptions.setTiffCompression(com.aspose.cells.TiffCompression.COMPRESSION_CCITT_4);

then output tiff image is not shown black. We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSJAVA-40680.

Hi Juraj,

Thanks for sharing the MS Word document.

I have tested the scenario (Doc to Tiff conversion) and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSJAVA-820. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Juraj,

We have fixed your issue.

Please download and try this fix: Aspose.Cells
for Java v7.6.1.3
.

Please see the following code.

Java


ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();



imgOptions.setTiffPhotometricInterpretation(TiffPhotometricInterpretation.WHITEISZERO);




Hello Shakeel,

I have tested the new version of the cells package and it works as wished :slight_smile: Thanks a lot for providing this feature.

I hope the same would be possible with the Words package as well. Thanks again.

Kind Regards,
Juraj

Hi,

Thanks for your feedback.

Good to know that your issue is resolved now. If you encounter any other issue, please feel free to post on our forum, we will be glad to help you further.


Thank you.

The issues you have found earlier (filed as CELLSJAVA-40680) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as WORDSJAVA-820) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.