2023.04.21 14:01 "Re: [Tiff] [EXTERNAL] Re: Specific image fails with error at TIFFWriteRawStrip function(26659675)", by Sulau
With the testfile LibTIFFCrsh1.cpp I get the error message: "TIFFWriteRawStrip: Must set "ImageWidth" before writing data."
That is, you can't just create a default TIFF directory (out = TIFFOpen(sInputSinglePage.c_str(), "w");) and then write image data to that directory without first setting up the mandatory tags accordingly.
Finally, you have to write the TIFF directory to the file. This is done by TIFFClose().
You should also close the input file at the end.
Finally, the input image data are "Group3Fax" compressed. That means the function TIFFReadRawStrip() reads nonsense. You need to read with TIFFReadEncodedStrip().
You should read the TIFF documentation at: http://www.simplesystems.org/libtiff/index.html
and get familiar with copying of data using as example: https://gitlab.com/libtiff/libtiff/-/blob/master/tools/tiffcp.c. I would suggest taking tiffcp.c in the debugger and debug how your file is copied there.
Another example, how to write a simple TIFF image is given in https://gitlab.com/libtiff/libtiff/-/blob/master/test/custom_dir.c line 63 to 128.