[Geotiff] Problem(s) in dealing with TIFF n Geo TIFF

TSP tsp.nrsa at rediffmail.com
Wed Aug 3 06:55:58 EST 2011


Dear Sir,
I am new to handling TIFF & Geo TIFF files and got libtiff.lib and geotiff.lib along with header files and so on. I have a problem. I want to read a (Geo) TIFF file, do some calculations on the actual pixels and write into a new (non existing) file. 
 
My C++/MFC program is able to read the tags, but I am getting errors:
 
short int xres, yres, unit, modeltypecode;
...
 
 
TIFFGetField(intif, TIFFTAG_XRESOLUTION, &xres);

TIFFGetField(intif, TIFFTAG_YRESOLUTION, &yres);

TIFFGetField(intif, TIFFTAG_RESOLUTIONUNIT, &unit);
 
... /* But the values of xres, etc. are quite strange */
 

TIFFSetField(outtif, TIFFTAG_XRESOLUTION, xres);

TIFFSetField(outtif, TIFFTAG_YRESOLUTION, yres);

TIFFSetField(outtif, TIFFTAG_RESOLUTIONUNIT, unit);
 
/* The program halts at one of the TIFFSets */
 
To admit, I don't have any skill on how to read pixel values from an existing TIFF data. I tried things like TIFFReadScanLine or such, but before reaching the reading, the program gives an error and exits. Of course TIFF reading is not a joke at all and it seems I will take ages to complete my work.
 
Can you please send me source code to reliably read TIFF files and if possible, copy the same into a new TIFF file. Your help will be greatly appreciated.
 
With many thanks,
 
Yours sincerely,
 T.S. Prasad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/geotiff/attachments/20110803/79c59081/attachment.htm 


More information about the Geotiff mailing list