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

Layer Comps to Files flatten tiff

New Here ,
Nov 13, 2017 Nov 13, 2017

Copy link to clipboard

Copied

Can anyone provide a modification to the javascript Layer Comps to Files that will add a checkbox option to save as a flattened TIFF? Or it could just be a script that executes the save as TIFF format with no layers, just like the option in Save As. I know I can do a workaround to flatten the layered TIFF files the script saves, but it would save a lot of time if that feature was built into the script. My layered files are big enough that reprocessing the large layered TIFF files is an added step I would like to avoid.

TOPICS
Actions and scripting

Views

2.3K

Translate

Translate

Report

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

People's Champ , Nov 13, 2017 Nov 13, 2017

Save a copy of your original "Layer Comps To Files.jsx" file.

Then

----------------------------------------------

1) In the file, find the lines

    // -- now after all the radio buttons

    dlgMain.cbIcc = dlgMain.pnlFileType.add("checkbox", undefined, strCheckboxIncludeICCProfile);

    dlgMain.cbIcc.value = exportInfo.icc;

    dlgMain.cbIcc.alignment = 'left';

    //********************************************************

    dlgMain.cbLay = dlgMain.pnlFileType.add("checkbox", undefined, "Include Layer

...

Votes

Translate

Translate
Adobe
People's Champ ,
Nov 13, 2017 Nov 13, 2017

Copy link to clipboard

Copied

Save a copy of your original "Layer Comps To Files.jsx" file.

Then

----------------------------------------------

1) In the file, find the lines

    // -- now after all the radio buttons

    dlgMain.cbIcc = dlgMain.pnlFileType.add("checkbox", undefined, strCheckboxIncludeICCProfile);

    dlgMain.cbIcc.value = exportInfo.icc;

    dlgMain.cbIcc.alignment = 'left';

    //********************************************************

    dlgMain.cbLay = dlgMain.pnlFileType.add("checkbox", undefined, "Include Layers");

    dlgMain.cbLay.value = exportInfo.layers;

    dlgMain.cbLay.alignment = 'left';

    //********************************************************

Insert the 3 lines that are between // ******************************************** comments and which are not in the original file

----------------------------------------------

2) In the file, find the lines

     // get setting from dialog

    exportInfo.destination = dlgMain.etDestination.text;

    exportInfo.fileNamePrefix = dlgMain.etFileNamePrefix.text;

    exportInfo.selectionOnly = dlgMain.cbSelection.value;

    exportInfo.fileType = dlgMain.ddFileType.selection.index;

    exportInfo.icc = dlgMain.cbIcc.value;

    //********************************************************

    exportInfo.layers = dlgMain.cbLay.value;

    //********************************************************

Insert the 1 line that is between // ******************************************** comments and which are not in the original file

----------------------------------------------

3) In the file, find the lines

function initExportInfo(exportInfo)

{

    exportInfo.destination = new String("");

    exportInfo.fileNamePrefix = new String("untitled_");

    exportInfo.selectionOnly = false;

    exportInfo.fileType = psdIndex;

    exportInfo.icc = true;

    //*********************************************

    exportInfo.layers = true;

    //*********************************************

Insert the 1 line that is between // ******************************************** comments and which are not in the original file

----------------------------------------------

4) In the file, find the lines

    case psdIndex:

        fileExtension = "psd";

        var saveFile = new File(exportInfo.destination + "/" + fileNameBody + ".psd");

        psdSaveOptions = new PhotoshopSaveOptions();

        psdSaveOptions.embedColorProfile = exportInfo.icc;

        //*******************************

        psdSaveOptions.layers = exportInfo.layers;

        //*******************************

        docRef.saveAs(saveFile, psdSaveOptions, true, Extension.LOWERCASE);

        break;

    case tiffIndex:

        fileExtension = "tiff";

        var saveFile = new File(exportInfo.destination + "/" + fileNameBody + ".tif");

        tiffSaveOptions = new TiffSaveOptions();

        tiffSaveOptions.embedColorProfile = exportInfo.icc;

        //*******************************

        tiffSaveOptions.layers = exportInfo.layers;

        //*******************************

        tiffSaveOptions.imageCompression = exportInfo.tiffCompression;

        if (TIFFEncoding.JPEG == exportInfo.tiffCompression)    tiffSaveOptions.jpegQuality = exportInfo.tiffJpegQuality;

        docRef.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);

        break;

Insert the 2 lines that are between // ******************************************** comments and which are not in the original file

----------------------------------------------

5) Good luck )

Votes

Translate

Translate

Report

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
New Here ,
Nov 13, 2017 Nov 13, 2017

Copy link to clipboard

Copied

That works perfectly. Thanks so much r-bin, that was incredibly helpful!

Votes

Translate

Translate

Report

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
Contributor ,
Nov 16, 2017 Nov 16, 2017

Copy link to clipboard

Copied

Oh man, how was this posted two days before I needed it! Thanks so much!

Votes

Translate

Translate

Report

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
New Here ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

LATEST

You are a legend!

Votes

Translate

Translate

Report

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
Participant ,
Dec 21, 2018 Dec 21, 2018

Copy link to clipboard

Copied

Hi all,

The layered tiff option works great but I have some additional feature requests.

When using the Export Layer Comps to files script you get a named psd/tiff with all the layers, including the layer comps.  The file sizes I'll be dealing with will only allow psb exports which isn't practical. 

What would be exceptionally useful is at the point of making the new doc, the layers would merge, extra channels/paths/layer comps removed as shown in this stand alone script we use now.

In the end the the saved psd/tiff would be a single layer on a transparent background, no channels/paths/layer comps/merged into one layer.  What do you think?

app.bringToFront();

var theImage = app.activeDocument;

theImage.channels.removeAll();

theImage.pathItems.removeAll();

theImage.layerComps.removeAll();

theImage.mergeVisibleLayers();

~Roy

Votes

Translate

Translate

Report

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
Participant ,
Dec 21, 2018 Dec 21, 2018

Copy link to clipboard

Copied

Got it.

//******** look for

var duppedDocument = app.activeDocument.duplicate();

                var fileNameBody = exportInfo.fileNamePrefix ;

//******inset 5 lines after

                var mergeImage = app.activeDocument;

                mergeImage.channels.removeAll();

                mergeImage.pathItems.removeAll();

                mergeImage.layerComps.removeAll();

                mergeImage.mergeVisibleLayers();

~Roy

Votes

Translate

Translate

Report

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