Skip to main content
Twinkkkle
Participant
November 19, 2014
Answered

Layer comps to files with auto trim

  • November 19, 2014
  • 2 replies
  • 4804 views

Hi there,

I am using the modified 'Comps to files.jsx' script to export my layer comps (using the label of the layer comp as my file name)

http://www.ps-scripts.com/bb/viewtopic.php?f=9&t=5277

It is a great script and makes my worklfow so much easier.

The only thing missing for me is a trim option when I run this script. as some of the layer comps have different heights

After I run the script, I have to manually crop all the jpgs in PS and then save them out again.

In the default 'Layers to Files' script that comes with PS, there's an option to auto trim png's when exporting the layers

I am thankful for any help on any of these questions I have.

- Is there something similar for layer comps?

- I've modified the original 'Comps to files' script and I now have the option (if I choose png as my file type) to trim the layer, but when I open the exported file it din't crop it.

- Is there an option to auto trim jpgs?

Thank you

Noel

This topic has been closed for replies.
Correct answer rvrbr8

There was a typo on one of the JPG variables.  Not sure how it was working for me with that typo.  Re-download and try again.

2 replies

schroef
Inspiring
January 16, 2020

HI guys i made an altered version which can also do layer comps from artboards. I also added more options like convert to sRGB and transparency works now for PNG and TIFF

Ill add that layer trim function as well. Need to check what it does actually

You can find my version here; https://community.adobe.com/t5/photoshop/update-layer-comps-amp-artboards-to-files/m-p/10861472#M298173

Participant
December 3, 2014

El Duderino-

It looks like you swiped code from the Layers to files script, which is a smart place to start, but then you plunked it down in the Layer comps to files script in an area where it's never referenced by the code.  Basically you want to take the PNG-8 and PNG-24 code snippets with their respective trim method calls and stick them in the proper case switch, just before the saveFile function is called...  and then swap app.activeDocument for docRef since that's variable with your document data that you're passing to the saveFile function. 

I uploaded a modified version of the script with these changes here: http://adobe.ly/1vOsgoN, it worked for me on CC 2014 trimming to the transparency. It does JPEG, too

Great name, BTW, I'm not into the whole brevity thing.

Twinkkkle
TwinkkkleAuthor
Participant
December 4, 2014

Thank you very much, mate.

I've run your script, but it doesn't crop the exported layer comps for me. (Running CC2014) Not sure what I am doing wrong.

I have a psd with two shapes, both have a different height. I run your script, with jpg and and trim selected but the exported jpg's still have the the height of the original psd file.

Really appreciate your help on this.

BTW, Greatest movie of all time :-)

rvrbr8Correct answer
Participant
December 4, 2014

There was a typo on one of the JPG variables.  Not sure how it was working for me with that typo.  Re-download and try again.