• 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 with auto trim

Community Beginner ,
Nov 19, 2014 Nov 19, 2014

Copy link to clipboard

Copied

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

TOPICS
Actions and scripting

Views

4.4K

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

New Here , Dec 04, 2014 Dec 04, 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.

Votes

Translate

Translate
Adobe
New Here ,
Dec 03, 2014 Dec 03, 2014

Copy link to clipboard

Copied

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.

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
Community Beginner ,
Dec 03, 2014 Dec 03, 2014

Copy link to clipboard

Copied

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 🙂

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 ,
Dec 04, 2014 Dec 04, 2014

Copy link to clipboard

Copied

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.

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
Community Beginner ,
Dec 07, 2014 Dec 07, 2014

Copy link to clipboard

Copied

Dude. Thank you, Thank you,Thank you.

Works amazingly well

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
Explorer ,
Apr 04, 2015 Apr 04, 2015

Copy link to clipboard

Copied

Thanks a lot for this!

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 ,
Dec 14, 2015 Dec 14, 2015

Copy link to clipboard

Copied

You are god among men.  This is an awesome resource and save me a ton of time when building out comps for prototyping!!

N

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
Community Beginner ,
Dec 17, 2015 Dec 17, 2015

Copy link to clipboard

Copied

Thank you for the amazing script rvrbr8. I do NOT understand why this isn't in the stock 'Layers to Files' script.

I tried to use this in CC 2015 and for JPGs it works, but not for PNGs. For PNGs, the whole transparent artboard is part of the file, but is trimmed off for JPEG, regardless of transparency settings.

Any ideas? Obviously the 'trim' function DOES work in some cases, but not in Photoshop CC 2015 using this script: Adobe Creative Cloud

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 ,
Feb 23, 2016 Feb 23, 2016

Copy link to clipboard

Copied

Hi,

I have also tried it in Photoshop CC 2015 and it didn't work.

It is still exporting files without the trim. Please help!

It would be massive improvement to the workflow

Thanks

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
Community Beginner ,
May 18, 2017 May 18, 2017

Copy link to clipboard

Copied

Created a separate batch action to crop PNGs and ran it after running the script and worked fine.

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
Advocate ,
Jan 16, 2020 Jan 16, 2020

Copy link to clipboard

Copied

LATEST

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#M298...

Layer Comps & Artboard To Files_v7_02.png

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