Git Product home page Git Product logo

photoshop-export-layers-to-files-fast's Introduction

Photoshop-Export-Layers-to-Files-Fast

This script allows you to export layers in your Photoshop document as individual files at a speed much faster than the built-in script from Adobe.

This script does not try to achieve feature parity with the built-in script, but rather provide a more streamlined / performant experience. That being said, feel free to make feature requests, and feel free to contribute to it and make it even more powerful!

Table of Contents

How to Use

Disclaimer: We are not associated with Adobe in any way. For any issues relating to Adobe products or Adobe scripts please contact them directly. We have never had an issue, but please use this script at your own risk. We are not responsible for any lost data or damaged PSDs so always make a back-up.

  • Go to the releases page and download the most recent release.
  • In Photoshop go to File -> Scripts -> Browse... and select the Export Layers To Files (Fast).jsx file.
    • NOTE: The script needs the Export Layers To Files (Fast)-progress_bar.json file to run as well. Without this you will get a "Progress bar resource corrupt" error. Please ensure that the .jsx and the .json files are siblings in the same directory.
  • You can add the script to the Scripts menu by adding all of the script files to Photoshop > Presets > Scripts
    • Windows: /Program Files/Adobe/Adobe Photoshop VERSION/Presets/Scripts
    • Mac: /Applications/Adobe Photoshop VERSION/Presets/Scripts

Example Screenshot

Screenshot of the script dialog

Features

Some of the features of the script include...

  • Supported export formats:
    • PNG (8 and 24 bit)
    • JPEG
    • TIFF
    • PDF
    • Targa
    • BMP
    • PSD
  • Handles nesting in grouped layers
  • Export either all layers or visible only
  • Files are named either using layer names, layer + group names, or automatic layer indices
  • Lowest layer can be treated as common background
  • Exported images can have layer size or canvas size (trimming option)
  • Last used dialog settings are remembered
  • A selected group can be exported as usual (layer by layer) while everything else is left in tact. (This way variable content can be exported for complex fixed background and foreground.)
  • Can export groups as folder hierarchy; conflicting folders are renamed

Extra Field Documentation

Selected Group

Will only export the selected group. Note that you must selected the group before launching the script, otherwise this option will be disabled. When you run the script this way, all other layers will be left untouched, meaning any visible layers on top or bottom may show in the export.

Ignore Layers Starting With

When this is selected, you can specify a prefix that will be used to match against layer names. Any matching layers will be ignored during the export.

For example, if you specify x in the input, all layers starting with the letter x will not be exported.

Filenames

Option Example
Use Layer Name (strip extension) layer-3.png => layer-3.png
Use Layer Name (keep extension) layer-3.png => layer-3.png.png
Use layer and parent group names group 1 > layer-3 => group-1-layer-3.png
Use index descending layer-10, where layer-10 is the top-most layer => 01
Use index ascending layer-5, where layer-5 is the top-most layer => 5

Use Custom Delimiter

Use Custom Delimiter will enable the use of a custom delimiter. Custom delimiters will be used instead of spaces in layer names and in the prefix/suffix fields. Note that the use of a space inside the file name is not supported by Photoshop, so by default a - delimiter will be used if not custom delimiter is specified.

For example: my layer 1 will export as my-layer-1

The following characters are not supported in the delimiter field: \, /, *, ?, |, ., :, ", <, >, %, ,, ;, =

Prefix/Suffix

Prefix and Suffix will add a prefix and suffix, respectively, to every exported filename, and is compatible with all the options in Filenames above.

The following characters are not supported in the prefix or suffix field: \, /, *, ?, |, :, ", <, >

Prefix Suffix Output Example
test- N/A test-layer-3.png
N/A .scale-100 layer-3.scale-100.png
test- .scale-100 test-layer-3.scale-100.png
{ii}- N/A 04-layer-3.png
{YYYY}- N/A 2021-layer-3.png

Variable Substitution

Prefix and Suffix fields can take the following string substitutes.

Option Example
{i} Will be replaced with the index of the layer
{ii} Will be replaced with the index of the layer, with a leading zero
{iii} Will be replaced with the index of the layer, with up to two leading zeros
{iiii} Will be replaced with the index of the layer, with up to three leading zeros
{ln} Will be replaced with the layer name. Useful for when exporting filenames as their index
{dn} Will be replaced with the document name
{M} Will be replaced with the month
{MM} Will be replaced with the month, with a leading zero
{D} Will be replaced with the date of the month
{DD} Will be replaced with the date of the month, with a leading zero
{YY} Will be replaced with the year, as the last two digits
{YYYY} Will be replaced with the year, as all four digits
{HH} Will be replaced with the hours, with a leading zero
{mm} Will be replaced with the minutes, with a leading zero
{ss} Will be replaced with the seconds, with a leading zero
{sss} Will be replaced with the milliseconds, with leading zeros

Known Gaps

  • Currently we do not support multiple artboards for export

Batch Processing / Actions

Many people like to set up the script once, and then use batch processing or actions to automatically run the script.

To use the script this way, follow these instructions:

  1. Run the script, set your desired settings in the dialog and then hit "Save and Close"
  2. Open up the script file, in TextEdit (Mac), Notepad (Windows), or in a code IDE.
  3. At the top of the script, locate the code that reads var BATCH_OPERATION = false;
  4. Change this to say var BATCH_OPERATION = true;
  5. You can now rerun the script, and it will auto-run with the previous settings.

In order to make changes to the settings again, you'll need to change BATCH_OPERATION back to false and rerun the script.

Requirements

We do our best to have the script be backwards compatible (back to Adobe Photoshop CS2) but are limited in what we can test for, both by Photoshop versions as well as OS. If you are encountering any issues with the current version, try downloading previous versions of the script instead.

Contributing

Please feel free to contribute! We appreciate it!

Here are some things to know:

  • When updating the dialog UI, please reference the dev/dialog.js and import it at https://scriptui.joonas.me/. Then, when you've made the appropriate UI changes, export the dialog and copy/paste the top comment block into the dev/dialog.js file and copy/paste the remainder into the showDialog function inside Export Layers To Files (Fast).jsx.
  • Be sure to test that any UI you add gets saved between script runs. i.e. If the user checks a checkbox, that checkbox should remain checked the next time they run the script.

Feedback / Bugs

Please use GitHub to write feedback/bugs/suggestions by filing an issue.

If you encounter a bug, please include the following information:

  • Your OS and OS Version
  • Your Photoshop version and release number
  • A screenshot (if applicable)
  • A .psd that reproduces the issue (the simpler the better)

photoshop-export-layers-to-files-fast's People

Contributors

allen880612 avatar antipalindrome avatar crtgregoric avatar finscn avatar jgod avatar jschaf avatar merofeev avatar scmyyc avatar skjorn avatar tangleworm avatar willena avatar yushiro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

photoshop-export-layers-to-files-fast's Issues

Define image size. For example - "not over 300kb"

Hello, I found your script at github and I'm thrilled! :) Ii is exactly what I was looking for. I miss only an OPTION - I would also like to define image size. For example - "not over 300kb".

Of course, Iwould like to donate for it even small sum :)

screenshot_15

Destination path copypaste support

So that's it: i want be able to copy path name and paste it in the destination field. Basically, I want be able to select the field and type path in there directly from the keyboard.

Feature Request: export .gif files

I've used this program to export PNG files of counties in Kansas (105 layers/counties) and the program is excellent! One of my programs uses GIF files. It uses GIF files since I can change the color of a layer by editing the text string for the GIF file. Perhaps I can also change the color in a PDF file, but I don't know how. If I exported the layers as GIF files they would work with my program.

Don't consider this request if it takes any effort. I've read the .jsx file and see that many parameters are set up and than it looks like an internal PhotoShop routine is called.

Thanks.

How to Export Using A Master Layer?

Hi,

Is there a way to export 100 layers using a specific master layer as the background?
Can i "tag" a layer to keep constant in the export process?

thanks!

Get rid of the initial alert

We should get rid of the initial pop-up warning and move it to the dialogue itself, which should feature a cancel button. It's annoying. Of course, I can do it in my fork, but then I'd like to benefit from future changes. I take it that this is sort of a maintenance repo for the script, so I'm opening up a discussion.

I'm happy to do the implementation myself, but we need to agree on a common vision.

Allow resizing the dialog

I seem to have too small screen resolution, since the dialog disappears.
Please allow resizing the dialog, with scroll bar and/or responsive positioning dialog elements.

openEXR

Thank you for the script. Do you plan to add the openEXR format ? Film artists around the world would be most grateful !

Expand trim option

I would like to have the option to trim layers just a pixel or two wider than layer actually is, usually I do this manually using expand selection feature and then I crop the layer.

CS6 Freezes when using Smart Objects

Fantastic little script you've got here. I've used it in testing and found it extremely intelligently designed. I particularly like the ability to keep the bottom layer as a constant, the fact that the naming isn't odd like the default one is, and it doesn't trim by default (who the heck wrote that script anyhow?)

This is exactly how I am using it. I've got 60 icons which are .ai objects in a PSD as smart objects. The graphics girl can then open the object in AI where she prefers to work and I can remain in PS. Then I can export all layers in the blink of an eye. Zoom.

However, when I have smart objects in the file, PS hangs immediately and becomes totally unresponsive. I made a test file that was just a few hundred KB with only 4 layers to test with. When exporting after rasterizing all the layers, it spits them out cleanly. When having a single smart object, the hang occurs.

I tried 3 times with each variable and it was 100% repeatable.

Note that the workaround is to rasterize all smart objects prior to running the script. There's a bit of preparation required (ie deleting extraneous background layers), so this isn't the end of the world, but there's 3 of us that use this file and it's worrisome to think that the file might get... knackered if someone accidentally saved on the way out (yes I've done that by accident before).

Using Win7 64, Production Premium CS6 package.

-k

Trim Layers to Images

The built in script has the option to automatically trim the generated images. It's to hard to implement this on this fast script?

Great work, thanks!

Become Indexed Files?

I have tested and i become only rgb Files not png indexed!

Can these change?

-stooni

Progress bar resource is corrupt?

Having downloaded the latest zip and tried to run it in photoshop cs6 / Yosemite constant error message appears
ember library mediator
(Progress bar resource is corrupt. Please redownload the script with all files)

File looks ok in preview.
Any suggestions?

Export groups as folders

Make an option to export the layer tree as a file tree, where layer groups would correspond to folders.

(Clean up old file tree with the same root folder name? Restart file name indices in sub-folders? Apply file name prefix to folders as well? There's a lot of details to figure out...)

Add File name prefix

File name prefix -- is it useful? The built-in script has it, yet I never used it once.
(This came up in the @finscn's update #12.)

creating constant layers

at present its only possible to have one background layer remain constant, id like to be able to have the option have making other files as well as whole directories constant.

Praise: This is awesome

I've never given feedback to someone on Github before so I'm not sure if this is the proper method but this script was a lifesaver for me. It took forever for the built in PS script to run and it didn't even get me what I wanted. Your script is gold. Thank you very much.

Trim images

I have a large PSD with a lot of layers in it. When I run the script, I get 300 images as a result with the same size (height/width) as the PSD file. So I have to crop every singe file :(

Edit: Ok, I just can create a custom action and run it over the new folder. But would be cool if there is an option to do it from script.

Help, exporting groups?

I recently found this nice script, but when running it, I couldn't get it to export whole groups.

Please tell me how I could export all selected GROUPS, with one png file PER GROUP. This would save me hours of time, if it worked.

Here are the groups I'd like exported:
screen shot 2015-05-15 at 1 11 46 pm

I'd like there to be one combined PNG per group, (so 10 pngs total) but after playing around with the settings, I couldn't achieve this. Please tell me how I could do this, or if it's not possible, please add this feature!

THanks, Stan

TinyPNG

Hi there
I've just picked up TinyPNG which is a fantastic plugin for seriously reducing file sizes of PNG-24 with transparency. Went from a 250kb file down to 65kb.

What modifications do I need to make to this script to export using TinyPNG?

This might be relevant..

Much appreciated
=: s

Use top layer instead of lowest layer

Hi,

First of all I want to point out that this script is fantastic and that it saved us quite a lot of time. We use it to generate mockups so it was awesome to be able to iterate through logos to our products.

However this time, we would like to show a new product so we need to add the logo on all of our canvas. So far it seems that this is impossible.

The expected result is the exact same logic, iterate through visible layers for example, but instead of keeping the lowest layer as a background, it would keep the highest layer as an overlay.

Any samaritan can help us with this?

Cheers,
B

Crash when adding trim

Hi Guys

Script work well WITHOUT trim. I'm just in that situation a have 500 images that needs to be trimmed for making clickable surface buttons in an application.

I work on Photoshop CS6 (OSX Yosemite 10.10.2)

I get this error when i add trim. What can i do?

Error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.

  • Could not complete the command because of a program error.: on line 374

Here i have attached som images of my process..

Thanks you in advance.

screen shot 2015-04-27 at 14 34 28
screen shot 2015-04-27 at 14 30 55
screen shot 2015-04-27 at 14 31 09

Second time i run the script with same adjustment as above these two error come:

screen shot 2015-04-27 at 14 45 33
screen shot 2015-04-27 at 14 45 39

Export visible layers only

I think there should be an option to export visible layers only. It should be relatively easy to implement using LayerComp. I'm more than happy to do it if I'm assured it will get to mainstream.

Saves as full sized image, ignores slices.

I've been looking for a much faster 'save layers to files' batch convert like this for a while. The reason being is the one that comes with photoshop while works wonders, it don't save the layers to the exact file name, and instead puts a bunch of numbers and such in front of all the file names.

I was joyed to learn that this one saves all the layers exactly as the file layer name is named... however... it saves the full size layers rather than just the 'area' the image is in.

I'm working with small files that could at times have 100 layers or more, there layed out across a larger sheet that displays them all, but each 'image' may only be 64x64 in size. Instead of saving say an 100x100 file into 64x64 peices as the images in each layer is set for and sliced to, it instead saves the while 100x100 file for each layer.

So I have layers that over lap one another, each layer creats a whole image, but need to be saved individually. Say, sprites for armor for a game, to mix and match. They are laid out over top each other in a means they would fit, same goes for the rest of the armors. I need to be able to save each of these peices in their own file at the size I have set in a slice for them so they save at the proper file name, save at the right image size.

Saving each layer and keeping the full size of the image sheet instead of cropping it down is useless to me.

If such an issue could be fixed this would be circulating across my work. Photoshops default is far to tedious, some having to rename a whole 1000+ images at times just to remove the numbers it insists on adding to the file name.

BMP as an option?

i know it's a relic, but Autodesk seems to love BMP as their custom button format :\

anyway, great work! this has saved me so much time :)

Obligatory Space replacement in filenames

Hi - loved this - just what I needed for a project - great speedy app that beats the stock one hands down.
However, having one major problem with it - it automatically replacing spaces in filenames with underscores. I understand why, but I wish to disable it - I need the spaces in my filenames!!

Tried replacing line 1302:
function makeValidFileName(fileName)
{
var validName = fileName.replace(/^\s+|\s+$/gm, ''); // trim spaces
validName = validName.replace(/[*/?:"|<>]/g, ''); // remove characters not allowed in a file name
//validName = validName.replace(/[ ]/g, '_'); // replace spaces with underscores, since some programs still may have troubles with them
return validName;
}

Weirdly, filenames returned now with a "-" rather than a "_":

stop_replacing.png > stop-replacing.png

can't find any code anywhere else that puts in a "-"!!!

Please help! I was close to finishing a 6 months project today, but came to a dead stop when hit this. :(

Thanks

Image compression 'Save For Web'

What would make this script realy complete for me, would be the option and have more control for 'Save For Web' compression to the JPG files.

When i export the layers to jpg with the script and play with the quality settings, the quality of the image is adjusted. But the image file-size is doesn't differ that much. When i use the photoshop built in 'Save For Web' option the jpg file size is approximately 70-80% smaller in file size with better image quality than when i use the script. Would be awesome if the built in Save For Web compression was used.

Export to PSD

I would like to export layers to separate psd to handle them separately.
I saw that in the standard export there is a PSD option but in this one it doesn't exist

Save for Web

Hello awesome contributors to the virtual world!

How about adding the option to export each layer as web safe or something similar that can dramatically reduce the file sizes but keep the quality of the images?

Photoshop CC 2014 freezes

Great work you guys have done here!

Unfortunately i can't get the script to work in Photoshop CC 2014 15.2.2 release or the older CC version 14.2.2. It keeps freezing when i press run. Photoshop freezes completely and the mouse shows a loading icon (which still moves).

Im running on an Imac with Yosemite 10.10.1.

Please let me know! Realy looking forward to use this.

Kind regards,
Iwan

Option to treat the lowest layer as background

An option to treat the lowest layer as background would be nice. That means keep it visible for every exported layer and don't export it by itself -- useful when having several variants with transparency against a common background.

Photoshop CC 2014 supported?

Error 21: undefined is not an object
Line: 354
-> dlgMain.ddFileType.itmes[exportInfo.fileType].selected=true;

Alpha channel from layer transparency

Generate alpha channel from layer transparency on the fly (i.e. wipe out alpha channels -> select visible pixels of the current layer -> save as alpha -> export -> repeat). Useful when exporting as TGA or BMP.

Options to use Folder/Group name as prefix or suffix

Hallo, hope you don't mind me suggesting a feature!

Example:
On a project I have one folder full of body part sprites for a 2D mannequin (animate in max or after effects for example) and another folder of layers containing dots used to specify vertices for each body part. A script will read the Foot_L_dots and Foot_L_Sprite images (once exported), then create a mesh from the dots and add the sprite as a texture.

It'd be great if related layers (Foot_L) could have the same name, but then have the folder name added as a suffix: Foot_L_Dots, Foot_L_Sprite. Another option would be to use the folder name as a prefix.
As the script currently stands I get Foot_L.png and Foot_L-001.png.

Progressive saving

Hey, thanks for the great script! I'm looking for to tweak this slightly so that it can save out 'progressive' layers. So turning on one layer at a time from the bottom to show the final full composition.

Is this something that can be done? Would appreciate any help, thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.