Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with save as (tiff compression options) javascript

Explorer ,
Sep 02, 2012 Sep 02, 2012

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

TOPICS
Actions and scripting
5.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Sep 02, 2012 Sep 02, 2012

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.

Translate
Adobe
Valorous Hero ,
Sep 02, 2012 Sep 02, 2012

It can't be done. JPEG quality is only valid for JPEG compression.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 02, 2012 Sep 02, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 02, 2012 Sep 02, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 02, 2012 Sep 02, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 03, 2012 Sep 03, 2012

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);

}


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 03, 2012 Sep 03, 2012
LATEST

Thank you much appreciated. You really are a great help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines