Copy link to clipboard
Copied
Hi can someone please help me alter this script from 'psd' to 'tiff'. I would like the script to specify particular compression options and I'm not sure how.
var saveFile = new File('~/desktop/'+(new Date().getTime().toString())+'.psd');
app.activeDocument.saveAs(saveFile);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
The compression options I would like are as follows
Tiff (8bit)
Image Compression - JPEGG Quality 10
Layer Compression - ZIP
1 Correct answer
OK Thanks Paul. I'll read and have a think about that. Just before I close the discussion, would you give me any pointers on the best scriptable compression method? I don't mind lossy, but need to keep the layers and colour profile. The smaller the better for ftp.
Explore related tutorials & articles
Copy link to clipboard
Copied
It can't be done. JPEG quality is only valid for JPEG compression.
Copy link to clipboard
Copied
Both those options are available in the tiff compression dialogue in CS5. Once you save CS5 offers you LZW, ZIP or JPEGG options for compression. The JPEGG option seems the most aggressive way to flatten the TIFF while retaining the layers.
Copy link to clipboard
Copied
If you look at the Photoshop Javascrip Ref.pdf (cs6) page 186 you will see that it says :-
Read-write. The quality of the produced
image, which is inversely proportionate to the
amount of JPEG compression.
Valid only when imageCompression =
TIFFEncoding.JPEG.
Copy link to clipboard
Copied
OK Thanks Paul. I'll read and have a think about that. Just before I close the discussion, would you give me any pointers on the best scriptable compression method? I don't mind lossy, but need to keep the layers and colour profile. The smaller the better for ftp.
Copy link to clipboard
Copied
With a quick test on the various compressions with psd I got the following:-
None = 123,197kb
Lzw = 89,038kb
Zip = 87,151kb
Jpeg 70,383kb
function SaveTIFF(saveFile){
tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.embedColorProfile = true;
tiffSaveOptions.alphaChannels = true;
tiffSaveOptions.layers = true;
tiffSaveOptions.imageCompression = TIFFEncoding.JPEG;
tiffSaveOptions.jpegQuality=10;
activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);
}
Copy link to clipboard
Copied
Thank you much appreciated. You really are a great help!

