2005.11.13 16:49 "Re: [Tiff] Calculate Offset and can't read ASCII", by Andrey Kiselev
On Thu, Nov 10, 2005 at 11:44:49AM +0100, Thomas Oldenkott wrote:
- I need a way to calculate the offset of an image. I want to export it in a csv-File. Is there a tag? How do I make this?
Yes, it is a tag called StripOffsets (273) and it contains an array of image chunks offsets. I some cases (ususally when the file is small) the whole data will be paced in the single chunk, but much more often there will be several chunks. Corrsponding tag StripByteCounts contains array of chunks sizes.
- By reading tags in an ASCII format (for example TIFFTAG_DATETIME) to an char array I get crazy values.
Where is the problem?
TIFFGetField(tif,306,&IMAGEDATETIME); printf("\nIMAGEDATETIME= %s", IMAGEDATETIME); TIFFSetField(out,306,IMAGEDATETIME);
Hmm, this should work with one except: you don't need to allocate array for the string, you will get a pointer to already allocated buffer which you shouldn't free. So it should look like that:
printf("\nIMAGEDATETIME= %s", IMAGEDATETIME);
// If we need to copy data for further needs
strncmp(NEWDATETIME, IMAGEDATETIME, 20);
NEWDATETIME = '\0';
Andrey V. Kiselev
Home phone: +7 812 5970603 ICQ# 26871517