Copy link to clipboard
Copied
Can any let me know how to read a tiff file and identify it's compression mode (LZW, JPEG, etc..) using photoshop sdk c++?
Copy link to clipboard
Copied
I believe a TIFF file can have multiple images in it. And a PSD (Photoshop file) has a tag for TIFF for all the interesting things.
https://www.itu.int/itudoc/itu-t/com16/tiff-fx/docs/tiff6.pdf
Copy link to clipboard
Copied
I am able to get the compression type form the meta data. which i'm currently doing. But there are cases where the meta data is not populated with this information, for e.g. If i export an art as tiff from Illustrator and open the file in photoshop the metadata is not populated with the compression type. So in order to get this info i need to save the document again in photoshop and open the saved image for processing. So I am wondering if i have any c API to retrieve the compression type, then i can have one less problem.
So Can some one post some ways to get image compression type using PSD c++ API.
Copy link to clipboard
Copied
Check out libtiff.
Copy link to clipboard
Copied
Checks the compression of tif.
void checkCompression(TIFF* tif) {
uint16_t compression;
TIFFGetField(tif, TIFFTAG_COMPRESSION, &compression);
const TIFFCodec* codec = TIFFFindCODEC(compression);
if (codec != NULL) {
printf("Codec for compression method %u is %s\n", compression, codec->name);
} else {
printf("Codec for compression method %u not found\n", compression);
}
}