2019.04.02 09:54 "[Tiff] TIFFWriteEncodedStrip is resulting in error.", by Ganesh Bondili

2019.04.02 10:45 "Re: [Tiff] TIFFWriteEncodedStrip is resulting in error.", by Kemp Watson

Ganesh:

Did you use TIFFSetErrorHandler to see what the actual issue is?

Also, be aware that XRESOLUTION and YRESOLUTION are floats, not integers.

[signature_1341774294]

W. Kemp Watson
+1 (416) 970-7284
Objective Pathology Services Limited
13629 Fallbrook Trail, Halton Hills
Ontario, Canada L7G 4S8

From: Tiff <tiff-bounces@lists.osgeo.org> on behalf of Ganesh Bondili <Ganesh.Bondili@kofax.com> Date: Tuesday, April 2, 2019 at 6:06 AM

To: "tiff@lists.osgeo.org" <tiff@lists.osgeo.org>

Subject: [Tiff] TIFFWriteEncodedStrip is resulting in error.

Hi LibTIFF,

We have a Customer that has reported that they are unable to convert attached(below link) PDF file(5C826DA7.pdf) from PDF to Tiff and resulting in error. We are using first Datalogics library to load & draw each page from PDF file to memory buffer which we then use LibTIFF library to write to TIFF file as below with given Tags set. In case of resolution ‘TIFFTAG_XRESOLUTION’ set as 300x300, error is generated at ‘TIFFWriteEncodedStrip()’ function with below values. Buffer looks good when saved as BMP file. Same file gets converted successfully for 200x200 resolution.

https://drive.google.com/open?id=1TvF1aj9L9z3ZuHru57ui0k0Cm37F8iO_

What is the reason for error for this PDF file at ‘TIFFWriteEncodedStrip()’ function and can this be resolved and converted to TIFF without error at 300x300 resolution.

                                TIFFSetField(hTIFF, TIFFTAG_IMAGEWIDTH, 24209);
                                TIFFSetField(hTIFF, TIFFTAG_IMAGELENGTH, 22730);
                                TIFFSetField(hTIFF, TIFFTAG_COMPRESSION, 7);
                                TIFFSetField(hTIFF, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
                                TIFFSetField(hTIFF, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
                                TIFFSetField(hTIFF, TIFFTAG_XRESOLUTION, 300); // works good for 200
                                TIFFSetField(hTIFF, TIFFTAG_YRESOLUTION, 300); // works good for 200
                                TIFFSetField(hTIFF, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
                                TIFFSetField(hTIFF, TIFFTAG_SOFTWARE, "Conv ");
                                TIFFSetField(hTIFF, TIFFTAG_SAMPLESPERPIXEL, 3);
                                TIFFSetField(hTIFF, TIFFTAG_BITSPERSAMPLE, 8);
                                TIFFSetField(hTIFF, TIFFTAG_PHOTOMETRIC, 2);
                                TIFFSetField(hTIFF, TIFFTAG_JPEGQUALITY, 75);

                                Ret1 = TIFFWriteEncodedStrip(hTIFF, 0, buffer, 1650811710);// Error occurs here - returns '-1' value
                                if (Ret1 != -1) {
                                                Ret2 = TIFFWriteDirectory(hTIFF);
                                }
Regards,
Ganesh.

Ganesh Bondili

Ganesh.Bondili@kofax.com

Register for the Free Trial of Kofax RPA<https://www.kofax.com/Products/Robotic-Process-Automation/Kapow/rpa-free-trial>

blog<http://www.kofax.com/blog/> | twitter<https://twitter.com/Kofax> | linkedin<https://www.linkedin.com/company/kofax> | facebook<https://www.facebook.com/kofax.inc>

________________________________

This communication is only for the use of the intended recipient. It may contain confidential or proprietary information. If you are not the intended recipient or have received this communication in error, please notify the sender via phone and destroy this communication immediately.