Jump to content
WnSoft Forums

Layers to PNG files


thedom

Recommended Posts

A lot of photoshop actions are avalaible on the web (see in particular excellent actions on http://panosfx.com/) to process images

("puzzle", "mosaic", "Big Picture", etc...).

But at the end of the action, the different parts of the image are in layers and you have to save them manually one by one.

And if you save those layers as they are, they have a lot of transparency, which is a torture for medium video card, especially when there are a lot of objects in the same slide (see Lin Evan's "Puzzle - High Ram" demo or my "Big Picture" demo).

You can make the job manually but it's really painfull and it takes a lot of times. <_<

I found an excellent script for Photoshop which automatically do the job for you !

It runs through every layer, crops them to size (optionnal) and saves them - with or without transparency (optional) - as a .png file to your chosen folder (with a name prefix of your choice) !!!

Tranberry-LayersTofilesPNG-Small.jpg

It saves you the time of going through each layer and doing it manually for each one. :P

Isn't life beautiful ? B)

This script can be donwloaded here : http://www.tranberry.com/photoshop/photosh...ayerstoPNG.html

Please, go visit http://www.tranberry.com/ and say "Thank you !" to Jeffrey, the author of this great script.

Installation

After downloading the script you must copy it into your Scripts folder.

On a PC, the default path is :

C:\Program Files\Adobe\Photoshop (CS or CS2)\Presets\Scripts\

After copying the script to this folder you'll need to quit and then restart Photoshop before the script appears in the File> Scripts menu.

To Run the Script

To run the script choose File> Scripts and select the script from the list, which will include any script file that was saved with a .js or .jsx extension and saved in the Presets/Scripts folder.

If you want to run the script that was saved in a different location, simply choose File> Scripts> Browse and navigate to the script.

Please, go visit http://www.tranberry.com/ and say "Thank you !" to Jeffrey, the author of this great script.

So, what do you think ? :)

UPDATE :

Once downloaded, the file of the name is :

Export Layers To Files_PNG.jsx.txt

You have to remove the .txt extension.

=> Export Layers To Files_PNG.jsx

I will (temporarily ?) host the file on my site with his correct extension and will ask the author his permission.

icon_pa_download.gif

Link to comment
Share on other sites

So, what do you think ? :)

Isn't there one more step? I think you must rename the file because if you download after opening the link you end up with an html and if you save as you end up with a .txt extension??

I just tried it but can't get it to work with layered files even after renaming. Do you have to have the "Script Listening" plug-in installed to make it work??

Looks good though - THANKS!

Best regards,

Lin

Link to comment
Share on other sites

Yes Lin, you're perfectly right, I forgot to mention it.

Once downloaded, the file of the name is :

Export Layers To Files_PNG.jsx.txt

You have to remove the .txt extension.

=> Export Layers To Files_PNG.jsx

I will (temporarily ?) host the file on my site with its correct extension and will ask the author his permission.

icon_pa_download.gif

Link to comment
Share on other sites

Dom,

Thanks for the tip - I downloaded the script (didn't even have to change the file name - it was already "jsx"), and it ran just fine in PS CS2, as you said - no error messages. :)

Thanks for pointing this out to us! I couldn't tell you how many times I've laboriously selected a layer, saved it "to web", then selected the next one, and so on. This will be very useful. :)

Link to comment
Share on other sites

I have been using the option provided with Photoshop, i.e. 'Edit with Imageready' then 'Export Layers as Files'

This script sounds very similar, what is the difference please?

Ron

The major difference is the choice to crop the PNG's to remove the excess transparency and the fact that you don't need to leave Photoshop.

Best regards,

Lin

Link to comment
Share on other sites

Hi All,

The ability to export "layers" as individual png's is fantastic but unfortunately, as I use Photoshop Elements, I'm not capable of using "script jfx's". I can save each layer as a png by selecting it alone or I can "save for web" an animated gif with transparency - open it in Irfanview then "export all frames" - then use Irfanview again to "batch convert" these files into png's. Thereby getting transparency. (It's actually kind of faster this way.) But, it would be nice to cut to the chase and be able to do this all fast while still in P. Elements and keep it all in png's. Any suggestions?

Even if a solution isn't possible I consider, it "no problem", as I've been a longtime "lurker" and have benefitted from all the "trials and tribluations" or should I say "sweat and TEARS" from the extended PTE family... so thanks!!!

Steve

Link to comment
Share on other sites

Here is Jeff's asnwer. Unfortunately incompatible with CS.

DOM,

No. The script is only compatible with CS2. Sorry. It'd take too much time

to make it work in both. I do my script work in free time - which I have

very little of at the present moment. If you want to debug it and touch it

up to work in CS, more power to you.

Sure. Feel free host or to pass the script around.

- Jeff

Anybody to adapt it for CS ?

Link to comment
Share on other sites

The major difference is the choice to crop the PNG's to remove the excess transparency and the fact that you don't need to leave Photoshop.

Best regards,

Lin

I've found syntax (primarily object spelling) errors at lines 172, 280, 329, 395, 484, 585. 663 amd 751 and corrected them, but there are other issues which are apparently incompatible with CS. I'm not a Java programmer so can't proceed further. After correcting the syntax errors and removing line #7 as a test, the code stopped at line 8 on the parse with yet another unrecognized command error so I think someone who speaks Java will have to take it from here - LOL

Best regards,

Lin

Link to comment
Share on other sites

Lin,

I found similar scripts. I didn't tried them though.

May be they are compatible with Photoshop CS :

Export photoshop layers to PNG

http://www.thatblokemike.com/blog/index.ph...iewcat&cat_id=5

(or direct link to download the script : www.thatblokemike.com/blog/files/PngExport.zip)

Layer to files script adding PNG support

http://ps-scripts.com/bb/viewtopic.php?t=255

(I don't think this one crops the layers)

Let us know how they work with CS... :)

Link to comment
Share on other sites

Lin,

I found similar scripts. I didn't tried them though.

May be they are compatible with Photoshop CS :

Export photoshop layers to PNG

http://www.thatblokemike.com/blog/index.ph...iewcat&cat_id=5

(or direct link to download the script : www.thatblokemike.com/blog/files/PngExport.zip)

Layer to files script adding PNG support

http://ps-scripts.com/bb/viewtopic.php?t=255

(I don't think this one crops the layers)

Let us know how they work with CS... :)

Since it's easy with ImageReady to export layers as files (but not crop) there is no real advantage to any script which does not actually crop the PNG's created, so the second one has little advantage except saving the step of switching to ImageReady to export.

The first one appears to do as explained when I tested it with a text file created in transparency on Photoshop CS, but I can't get it to work with the Panos puzzle action. I first tried it with a 56 piece puzzle thinking it would create separate files, but it wouldn't work. Then I used ImageReady to export the 56 piece (actually 48 pieces because of the aspect ratio) puzzle to separate PNG files. I then opened the first one and the script promptly allowed me to export a cropped version, but when I opened the second piece and attempted to perform the same script it successfully cropped the second piece but overwrote the first with the same file name, to to be effective one would have to have a separate folder for each piece.

I then tried a four piece puzzle thinking that perhaps 48 pieces were too much (I ddn't actually try reading the Java code to see how it works) and it wouldn't recognize the four pieces as separate layers. I'm not certain what the issue is.

Have you tried the original script (the one which is incompatible with CS) after creating puzzle pieces with the Panos Action? Just curious if it recognizes the separage layers.

Best regards,

Lin

Link to comment
Share on other sites

I found an excellent script for Photoshop which automatically do the job for you !

It runs through every layer, crops them to size (optionnal) and saves them - with or without transparency (optional) - as a .png file to your chosen folder (with a name prefix of your choice) !!!

[]

This really is an excellent time saver.

One little problem, however, if the image being saved as a PNG has a drop shadow, created as a Layer Style in Photoshop, and the "crop" option is selected. The result is not quite what you might expect!

I'd be interested to hear if anyone else has experienced a problem.

John

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...