0

I have been searching for a while know and I can't find a solution to solve my problem. I'm using libtiff library to write huge ( > 10Go) tiled images. Without any compression, everything works fine. But problems start when I try to compress the tiles.

Here is my code:

TIFF *m_outBigTiffFile = TIFFOpen("HugeMapping.tif", "w+");
TIFFSetField(m_outBigTiffFile, TIFFTAG_IMAGEWIDTH, width);   
TIFFSetField(m_outBigTiffFile, TIFFTAG_IMAGELENGTH, height); 
TIFFSetField(m_outBigTiffFile, TIFFTAG_BITSPERSAMPLE, 8);       
TIFFSetField(m_outBigTiffFile, TIFFTAG_COMPRESSION, COMPRESSION_JPEG);
TIFFSetField(m_outBigTiffFile, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
TIFFSetField(m_outBigTiffFile, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(m_outBigTiffFile, TIFFTAG_SAMPLESPERPIXEL, sampleperpixel);  
TIFFSetField(m_outBigTiffFile, TIFFTAG_ROWSPERSTRIP, 1);
TIFFSetField(m_outBigTiffFile, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(m_outBigTiffFile, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
TIFFSetField(m_outBigTiffFile, TIFFTAG_TILEWIDTH, tileW);   
TIFFSetField(m_outBigTiffFile, TIFFTAG_TILELENGTH, tileH);
int tileSize = TIFFTileSize(m_outBigTiffFile)

When I try with the Tag COMPRESSION_JPEG or COMPRESSION_LWZ, the images cannot be opened. I have the folowwing errors trying to read : " LZWDecide : Corrupted LZW table at scanline 0" Or "JPEG compression support is not configured" Or " Not a JPEF file: starts with 0x4c 0x49

Does anyone have an idea of what could be the problem here? Thanks for your help :)

Piu
  • 1
  • 2
  • What's a `Go`, should that read `Gb`? What about installed/available memory size as compared to the expected size of the output? How about memory consumption during execution? – enhzflep Sep 09 '16 at 11:31
  • Gb and no Go sorry. – Piu Sep 12 '16 at 07:37
  • Gb and no Go sorry. As I'm writting the image as a tiled image, there is not a big memory consumption. The image is being filled with one buffer (size: 1024*1024) at each iteration. And I have more than enough memory available on the computer. As I said, there is no poblem when I'm using the TAG "COMPRESSION_NONE" ... – Piu Sep 12 '16 at 07:43
  • Some interesting links: **(0)** memory requirements for lzw compression http://stackoverflow.com/questions/3203321/lzw-compression-decompression-under-low-memory-conditions (look for the answer by Dummy00001) and **(1)** a page that talks about large, compressed tiff files: http://bigtiff.org/ - pay attention to the resolution of the sample images - compressed with jpeg compression at an average of about 20:1 iirc - I imagine the important bigtiff changes are since implemented in libtiff – enhzflep Sep 12 '16 at 13:16
  • What are you trying to view the resultant image in? I use QGIS and irfanview. – Damian Dixon Jul 24 '17 at 17:44

0 Answers0