Free Support Forum - groupdocs.com

Convert .TIFF to .PNG problem


#1

Hi,

We got different dimensions after converted .TIFF file to .PNG file. for details please refer attached files.
Could you please check what’s the problem?

Thanks.

#2
Hello,

Thank you for your request.

Could you please specify version of the GroupDocs.Conversion for Java library that you use. Also will be useful if you share with us your file example and code converting example, so we will be able to investigate your issue.

We will wait for your details.

---------

Best regards,
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+


#3

The latest version 3.0.0

Thanks.

#4
And just use sample code as below, would got same result:

public static void convertToPNGAsFilePath(String fileName)throws IOException{
// Instantiating the conversion handler
ConversionHandler conversionHandler = new ConversionHandler(Utilities.getConfiguration());
SaveOptions saveOption = new ImageSaveOptions();
saveOption.setConvertFileType(ImageSaveOptions.ImageFileType.Png);
saveOption.setOutputType(OutputType.String);

List convertedDocumentPath = conversionHandler.<List> convert(fileName, saveOption);
}


#5

Hello,


Thank You for taking interest in GroupDocs.Conversion for Java 3.x and posting your query.

The screenshots you have shared are showing same dimensions for both files which is 1728x1117, so please elaborate your issue in more details.

We shall surely appreciate your coordination.

Best Wishes.

#6

Hello,


Thanks for response.
Yes, dimensions are same: 1728x1117, the point is “Horizontal resolution” of TIFF, it is 200 dpi, different with vertical resolution(100dpi). so when open the TIFF, it actually looks like 864x1117.

Is there way to handle different horizontal and vertical DPI in such case?

Best wishes!

#7

Hello,


Thank You for the explanation.

Yes you can change the dpi of image using setDpi method of ImageSaveOptions class and passing its object into convert method of ConversionHandler class.

Best Wishes.

#8

Hello Vincent,


We are pleased to notify you that GroupDocs.Conversion for Java 17.3.0 is on-board. Your reported issue is fixed in this release. In order to set Horizontal/Vertical resolutions, you may follow the given code:

setHorizontalResolution(100);
setVerticalResolution(200);

You can set resolutions like this:

ImageSaveOptions saveOption = new ImageSaveOptions();
saveOption.setConvertFileType(ImageSaveOptions.ImageFileType.PNG);
saveOption.setOutputType(OutputType.String);
saveOption.setHorizontalResolution(100);
saveOption.setVerticalResolution(200);
List convertedDocumentPath = conversionHandler.<List>convert(fileName, saveOption);

Please integrate the latest version of the API in your project and share your valuable feedback.
Kind regards