Tuesday, December 2, 2014

automation - How to Batch Export All Directory Contents to PNG-8, Overwriting Existing Files?


Based on some preliminary manual testing, I've found that exporting as png-8 as one might expect provides significant file size reduction. One of my test images went from 58.8 kb to 10.7 kb.


With a delivery size of around 1 GB, my graphics package needs some trimming to make it play nicer, both with remote secured asset deliveries and for better performance in a low-storage embedded environment.


I want to roll this approach out to exporting all my images in my delivery to png-8. The problem is I have been unable to figure out how precisely to do that.


I tried record an action. I created a new action set, created new action w/ my template file open, select Quick Export to png-8 in the File > Export menu, I click save, click "Yes, overwrite existing file", then Ctrl+W to close. Stop recording.


When I try to run this action set on a directory of images, going to File > Automate > Batch, it opens them and closes them without saving.


If I select Save & Close in the circled box in the Batch dialogue, it seems to be saving them, but just as normal png files, not png-8:


Save and Close in Batch dialogue


It's interesting to note that my Export performed during the record period of the action does not seem to be noted in the Actions pane:



Action pane


Expanding Close I see saving: no which is technically true... as I exported, not saved. But there's nothing there about the export.


My PS is PS CC cloud, version seen below (Windows 7, 64-bit):


PS version


How do I get the Batch process to:



  1. Export to png-8.

  2. Automatically confirm overwriting the existing png during this save process. (I will be always overwriting the existing copy.)


Thanks!




Answer



You need to use Export > Save for Web (Legacy) if you want to include it in an action. Neither the Quick Export, nor Export As can be included in an action, as of Photoshop CC 2017. This may change in future releases, but since these are still fairly new features, Adobe hasn't made them actionable yet probably to avoid issues with compatibility with older versions of Photoshop which don't have these new commands.


When you set up your Automate > Batch - make sure the source and destination folders are set up to the same folder. In the options check the Overide Action "Open" Commands, and Overide Action "Save as" Commands.


And now a warning: Make sure you are not editing your original PNG-24s. Work on a copy of the image folder, because once you have overwritten them, you will loose some alpha transparency and colour data that can't be undone by converting back to PNG-24.


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...