There is a manual operation that I do ALL THE TIME in Photoshop: exporting a single layer to a single PNG or JPEG file. Every time, I copy the content of a layer, create a document, paste the content, save for the web, etc… So I took the opportunity to create a script that will automate these tasks. You could use the classic Photoshop actions, but I like the freedom of coding to control the experience.
I showcase my script “Export selected layer” at the beginning of my video tutorial, but you can test it yourself in Photoshop. To do so, just open the Adobe Exchange panel in Photoshop and search for my name “chaize”, or type “export”. You’ll be able to install and test my script.
The video tutorial: Develop a script for Photoshop in less than 15 minutes
It’s in High Definition on YouTube. Enjoy:
My Script: The source code
Here is the source code of my script that exports the selected layer of your PSD to a transparent PNG:
If you have any questions, don’t hesitate to post a comment.
In a future post, I’ll explain how to distribute your panel on the Adobe Exchange marketplace, and I’ll feature some cool scripts for Photoshop coders such as the xTools. I’ve also been told that the pan PNG-Express is a professional script to produce PNG files from layers, with A LOT of features compared with my little script.