Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: EXPORT LAYERS TO FILES

  1. #1

    EXPORT LAYERS TO FILES

    I know how to export layers to files, but I have one layer which I want to have as the constant background for each layer. How do I accomplish this without having to manually duplicate and merge my "background" layer with each of the layers?

    In other words, I want to export my layers as individual files, with ONE of the layer as the background layer to all the layers.

    Any assistance of how to do this is greatly appreciated.

    [Edited on 1/28/2008 by NewYorker]

  2. #2
    Regular
    Join Date
    Nov 2002
    Location
    Lowell, MA.
    Posts
    519
    I think if you select the layers you want and make only those layers visible then when you go to Layers > Duplicate it will work, then all you have to do is shut off the visibility of the one layer you don't need and turn the visibility on for the next file and so on.

    I tried it and it works but I could be missing something!

    Pete

  3. #3
    mvillagojr
    Guest
    Set your background layer - name it "Background " or select your layer and from the Layer menu select New > Background from Layer.

    Find the file Export Layers To Files.jsx.
    Should be in C:\Program Files\Adobe\Adobe Photoshop CS3\Presets\Scripts
    Make a backup copy.

    Find the Function: setInvisibleAllArtLayers

    And replace it with this code

    ///////////////////////////////////////////////////////////////////////////////
    // Function: setInvisibleAllArtLayers
    // Usage: unlock and make invisible all art layers, recursively
    // Input: document or layerset
    // Return: all art layers are unlocked and invisible
    ///////////////////////////////////////////////////////////////////////////////
    function setInvisibleAllArtLayers(obj) {

    for( var i = 0; i < obj.artLayers.length; i++) {
    if (obj.artLayers[i].name != "Background") {
    obj.artLayers[i].allLocked = false;
    obj.artLayers[i].visible = false;
    }
    }
    for( var i = 0; i < obj.layerSets.length; i++) {
    if (obj.artLayers[i].name != "Background") {
    setInvisibleAllArtLayers(obj.layerSets[i]);
    }
    }
    }

    All it does is skip the layer named Background when making the rest of the layers invisible.

    I also changed the Title of the box

  4. #4
    ianim8
    Guest
    I tried this and it didnt work. I got an error "Error: No such element".
    What I wanted to try is where I have a foreground object that stays on at all times while the below layers are exported. Basically if I had 200 Xmas photos (layers) and a top layer title "Merry Christmas 2009" that exports with each underlying layer. Is this possible? Ive tried with the basic "Background" at first and that didnt work for me
    Thanks in advance!!

  5. #5
    -1 . . ■ . . +1 Whubee's Avatar
    Join Date
    Jul 2004
    Location
    Long Island, N.Y.
    Posts
    586
    What I would do is to create a new blank document with a transparent background that is the size of the images you have.

    Start a recording a new action.
    Create your text layer, move it into position.
    To resize the text, got to free transform and click the little chainlink between the width and height % and change one of the % numbers to the appropriate size.
    Click ok.
    Stop the action.

    Next run the batch command and select the folder you have your 200+ images in. select the destination folder you want and run the batch.

  6. #6
    ianim8
    Guest
    Thanks Whubee that does work in that set-up, but at times we have docs with multiple layers and would like to just export them as is.
    However good tip though cause it does do the trick

  7. #7
    -1 . . ■ . . +1 Whubee's Avatar
    Join Date
    Jul 2004
    Location
    Long Island, N.Y.
    Posts
    586
    I guess you have all the images open in one document?
    If you are doing it that way, you could just use layer comps.

    You could create a new comp for each layer and use the method Elgreco suggested " shut off the visibility of the one layer you don't need and turn the visibility on for the next file and so on."
    Then export layer comps to files.
    The command is located under the scripts menu.

  8. #8
    timoto
    Guest

    Include Background Script

    I've also tried adding this script and got the same error.

    Has anyone found the code that will work, I'd really like to have this functionality back again. ImageReady used to do it, but I've lost my copy of it.

    Thanks

    Tim

    Originally posted by mvillagojr
    Set your background layer - name it "Background " or select your layer and from the Layer menu select New > Background from Layer.

    Find the file Export Layers To Files.jsx.
    Should be in C:\Program Files\Adobe\Adobe Photoshop CS3\Presets\Scripts
    Make a backup copy.

    Find the Function: setInvisibleAllArtLayers

    And replace it with this code

    ///////////////////////////////////////////////////////////////////////////////
    // Function: setInvisibleAllArtLayers
    // Usage: unlock and make invisible all art layers, recursively
    // Input: document or layerset
    // Return: all art layers are unlocked and invisible
    ///////////////////////////////////////////////////////////////////////////////
    function setInvisibleAllArtLayers(obj) {

    for( var i = 0; i < obj.artLayers.length; i++) {
    if (obj.artLayers[i].name != "Background") {
    obj.artLayers[i].allLocked = false;
    obj.artLayers[i].visible = false;
    }
    }
    for( var i = 0; i < obj.layerSets.length; i++) {
    if (obj.artLayers[i].name != "Background") {
    setInvisibleAllArtLayers(obj.layerSets[i]);
    }
    }
    }

    All it does is skip the layer named Background when making the rest of the layers invisible.

    I also changed the Title of the box

  9. #9
    acreep
    Guest
    well, the way to do this is:

    1) you don't need to modify "setInvisibleAllArtLayers()" because no matter what all of the layers are being set to invisible because of the layerSets
    2) all is need is three more lines of code in "exportChildren()"
    3) '=="BG"', the "BG" will be whatever you call your background layer. if you call it "Background" then your IF test will end with '=="Background"'


    these are the three lines:
    Code:
    // to keep background layer this test is necessary
    /////////////////////////////////////////////////////////
    if(orgObj.artLayers.name=="BG"){
    continue;
    }
    dupObj.artLayers.visible=true;
    /////////////////////////////////////////////////////////
    you can just copy and paste the code below to replace the entire "exportChildren()" if you don't trust yourself to drop that code in the right spot.
    Code:
    ///////////////////////////////////////////////////////////////////////////////
    // Function: exportChildren
    // Usage: find all the children in this document to save
    // Input: duplicate document, original document, export info,
    //        reference to document, starting file name
    // Return: <none>, documents are saved accordingly
    ///////////////////////////////////////////////////////////////////////////////
    function exportChildren(dupObj, orgObj, exportInfo, dupDocRef, fileNamePrefix) {
        for( var i = 0; i < dupObj.artLayers.length; i++) {
            if (exportInfo.visibleOnly) { // visible layer only
                if (!orgObj.artLayers[i].visible) {
    				continue;
    			}
            }
            dupObj.artLayers[i].visible = true;
    
    // to keep background layer this test is necessary
    /////////////////////////////////////////////////////////
    			if(orgObj.artLayers[i].name=="BG"){
    					continue;	
    				}
    			dupObj.artLayers[i].visible=true;
    /////////////////////////////////////////////////////////
            var layerName = dupObj.artLayers[i].name;  // store layer name before change doc
            var duppedDocumentTmp = dupDocRef.duplicate();
            if (psdIndex == exportInfo.fileType) { // PSD: Keep transparency
    
                removeAllInvisible(duppedDocumentTmp);
            } else { // just flatten
                duppedDocumentTmp.flatten();
            }
            var fileNameBody = fileNamePrefix;
            fileNameBody += "_" + zeroSuppress(i, 4);
            fileNameBody += "_" + layerName;
            fileNameBody = fileNameBody.replace(/[:/*?"<>|]/g, "_");  // '/:*?"<>|' -> '_'
            if (fileNameBody.length > 120) {
    			fileNameBody = fileNameBody.substring(0,120);
    		}
            saveFile(duppedDocumentTmp, fileNameBody, exportInfo);
            duppedDocumentTmp.close(SaveOptions.DONOTSAVECHANGES);
    
            dupObj.artLayers[i].visible = false;
        }
        for( var i = 0; i < dupObj.layerSets.length; i++) {
            if (exportInfo.visibleOnly) { // visible layer only
                if (!orgObj.layerSets[i].visible) {
    				continue;
    			}
            }
            var fileNameBody = fileNamePrefix;
            fileNameBody += "_" + zeroSuppress(i, 4) + "s";
            exportChildren(dupObj.layerSets[i], orgObj.layerSets[i], exportInfo, dupDocRef, fileNameBody);  // recursive call
        }
    }
    [Edited on 12/19/2008 by acreep]

  10. #10
    Mahdi007
    Guest
    Originally posted by timoto
    I've also tried adding this script and got the same error.

    Has anyone found the code that will work, I'd really like to have this functionality back again. ImageReady used to do it, but I've lost my copy of it.

    Thanks

    Tim
    Same, found this on Google. Heres the working code (works in CS3)

    Code:
    ///////////////////////////////////////////////////////////////////////////////
    // Function: setInvisibleAllArtLayers
    // Usage: unlock and make invisible all art layers, recursively
    // Input: document or layerset
    // Return: all art layers are unlocked and invisible
    ///////////////////////////////////////////////////////////////////////////////
    function setInvisibleAllArtLayers(obj) {
        for( var i = 0; i < obj.artLayers.length; i++) {
    	if (obj.artLayers[i].name != "Background"){
            obj.artLayers[i].allLocked = false;
            obj.artLayers[i].visible = false;
    	}
        }
        for( var i = 0; i < obj.layerSets.length; i++) {
            setInvisibleAllArtLayers(obj.layerSets[i]);
        }
    }
    Hopefully this helps someone like me. Again, this is to leave the "Background" layer visible while exporting layers to files in Photoshop CS3.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •