AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
September 2007

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



2007.09.12 11:49 "Modyfying TIFFTAG_COLORMAP", by <mikk@go2.pl>

Hello all,

I need to modify colors in TIFF image with PHOTOMETRIC = PALETTE. I want 
to do it as fast as possible. My idea is to do it without decoding the 
image data when reading and without involving any codec functions for 
writing. 

My idea is:

1. Scan IFD for TIFFTAG_COLORMAP in a file opened for read/write.
2. When found, remember its offset (position in a file).
3. Read palette entries into buffers (being aware of byte order).
4. Modify palette entries in buffers (apply color adjust on palette 
entries).
5. Set file position to remembered offset for values of TIFFTAG_COLORMAP.
6. Write palette entries from buffers (being aware of byte order) to 
file (overwrite old values of TIFFTAG_COLORMAP).

Are my assumptions for this algorithm OK? Am I right when I assume that 
these modifications in the TIFF file structure is safe in all cases?

Kind regards,
mikk