Copiar vínculo al Portapapeles
Copiado
I have been tasked with creating a script that determines the compression used in existing files and then resaving only those that are not using LZW. I cannot seem to find a way to determine the current files compression.
Copiar vínculo al Portapapeles
Copiado
Perhaps reading the input file list as binary data and or hex and searching the content for the files that don't use the TIFF tag for LZW compression... I have seen similar tricks in Bridge scripting when looking for other specific data embedded in the file, but can't help much beyond that.
ExifTool can easily find the compression method used in a TIFF file, for example for a file with LZW:
Compression = 5
Tag 0x0103 (2 bytes, int16u[1]):
0042: 00 05
So the data must be there, it would be easy enough for ExifTool to flag these images using a label or rating or other metadata, however, this is far from ideal.
https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577413_pgfId-1035272
Tag 259 |
Name Compression |
Photoshop Reads 1 (uncompressed), 2 (CCITT), 5 (LZW), 7 (JPEG), 8 (ZIP), 32773 (PackBits) |
Photoshop Writes 1, 5, 7, 8 |
Good luck!
Copiar vínculo al Portapapeles
Copiado
Was hoping to keep the script inside photoshop instead of having to have some sort of handshake with Bridge. I had seen the article mentioned, and are using it to get the Tranparency flag, but don't see in the TIFF data how to get Tag 259.
Copiar vínculo al Portapapeles
Copiado
I was suggesting doing similar/same directly in Photoshop, I was just using Bridge as an example as that is where I have seen this technique used.
Here is one for Photoshop:
https://community.adobe.com/t5/photoshop/get-transparency-status-on-tiff-images/td-p/9270519?page=1
I don't know either, this is above my pay grade. I'm hoping that somebody else can join in the discussion.
(TIFF Tag) 259 can also be expressed in hex as 0x0103.
ExifTool can find this compression tag and other compression tags in the file, I'm sure that Photoshop can too, the devil is always in the details.
Copiar vínculo al Portapapeles
Copiado
try it for file:
#target photoshop
var f = new File('e:/_output/testfile.tif'),
compression = { 1: 'uncompressed', 2: 'CCITT', 5: 'LZW', 7: 'JPEG', 8: 'ZIP' }
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript')
xmpMeta = new XMPFile(f.fsName, XMPConst.FILE_TIFF, XMPConst.OPEN_FOR_READ).getXMP()
alert(compression[xmpMeta.getProperty(XMPConst.NS_TIFF, 'Compression')])
or for opened document:
#target photoshop
var compression = { 1: 'uncompressed', 2: 'CCITT', 5: 'LZW', 7: 'JPEG', 8: 'ZIP' }
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript')
xmpMeta = new XMPMeta(app.activeDocument.xmpMetadata.rawData)
alert(compression[xmpMeta.getProperty(XMPConst.NS_TIFF, 'Compression')])
Encuentra más inspiración, eventos y recursos en la nueva comunidad de Adobe
Explorar ahora