Libtiff gives functions to manipulate TIFF image attributes, my code uses such functions, but I am having some issues using them. This lead me to thinking, does changing attribute values of a TIFF image really help us achieve compression? Am i right? corect me.
Asked
Active
Viewed 354 times
-2
-
My question is that manipulating TIFF attributes manually, would reuslt in actual compression or not? – harsha217 Jul 11 '14 at 18:11
1 Answers
2
Changing attributes (aka tags) like Compression
won't change compression of the image. And acting this way you can corrupt the image.
If you are trying to change compression of the image then you should decompress it first and the compress with a new compression scheme. You will have to copy relevant tags as well.
Take a look at source code for tiffcp
utility. This utility does exactly this: it changes compression of TIFF images (besides some other things).
EDIT:
Other tags like RowsPerStrip
, StripByteCounts
, StripOffset
can't be changed without corrupting image, either. You should only changes these if you are absolutely certain that values are wrong (because of broken generator or something like this) and you are trying to fix the image.

Bobrovsky
- 13,789
- 19
- 80
- 130
-
Thanks for the reply. I do understand that to compress a TIFF image with a new scheme, what you said is absolutely right. What I want to know is that, can I manipulate image attributes like RowsPerStrip,StripByteCounts,StripOffset? Without corrupting the image. There is not much documentation available on those attributes, but I strongly feel that those can be be modified. – harsha217 Jul 11 '14 at 20:25
-
2@harsha217: No. You can't change them either, without corrupting the image. These tags are important information written by the encoder, to instruct decoders how to interpret the image data, and is well documented in the [TIFF spec](https://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf). If you want to change these values, you must, as Bobrovsky says, re-encode the image with the new values. – Harald K Jul 11 '14 at 20:53