2006.03.09 07:44 "Re: [Tiff] tiff headers", by Andrey Kiselev
On Wed, Mar 08, 2006 at 08:57:56PM -0500, Jasmin Roohi wrote:
Hello. I've been trying to alter the content of a tiff header. The tiff header contains the following information:
What do you mean as a "TIFF header"? Could you show tiffinfo/tiffdump output for these files?
2 Images, TIFF (compressed)
Image Wavelengths=635, 635
Size=1500x3800, 1500x3800 pixels
Scaling=10, 10 µm per pixel
Image Format=16-bit grayscale
PMT Gain=0, 0
Laser Power=100, 100
Normalization Factor=1.000, 1.000
I used the following Linux code to change "Scaling=10, 10 µm per pixel" to "Scaling=5" but had no luck. The images "both layers combined.tif" and " test.tif" are identical except "both layers combined.tif" is compressed. I would be grateful for any help you could give me. Thanks.
[roohi@elipc2 roohi]$ ls
both layers combined.tif
[roohi@elipc2 roohi]$ tiffset
usage: tiffset [-s name value] filename
[roohi@elipc2 roohi]$ man tiffset
No manual entry for tiffset
The recent libtiff releases contain manual page for tiffset. You can try to update the your one.
[roohi@elipc2 roohi]$ tiffset -s Scaling 5 both\ layers\ combined.tif
both layers combined.tif: Can't open a compressed TIFF file with compression for update..
That should work. I am recommend to grab the CVS snapshot and try it. But you can't add an arbitrary tag to TIFF. tiffset only can work with predefined set of tags, hardcoded in the library (see the tiff.h/tif_dirinfo.c for the list of hardcoded tags). It is possible to work with arbitarry tags using the custom tag way, but it requires writing your own utility based on libtiff (search list archives for sample code).
[roohi@elipc2 roohi]$ tiffset -s Scaling 5 test.tif
test.tif: Warning, unknown field with tag 700 (0x2bc) ignored.
test.tif: Warning, unknown field with tag 34665 (0x8769) ignored.
That is what I said above: all unknow tags will be skipped and their contents will be lost when the header will be rewritten.
Andrey V. Kiselev