Copy link to clipboard
Copied
How can I batch process hundreds of files to Webp format? I have been using PS for decades, and there is no native way that I can see of batch exporting images as Webp files.
I can do this in Lightroonas jpegs, but they are too large. Is there any way of batch converting 400 jpeg files to webp?
I tried batch processing for the first time after creating a "Save as Copy" script, but it made me go through each step manually and did not save time. Any thoughts on this matter would be greatly appreciated.
Copy link to clipboard
Copied
Creating an action and using the batch command is the "standard native way", perhaps your action was set to "step by step" and not "accelerated" playback.
Anyway, I wrote a script for this:
Copy link to clipboard
Copied
Thank you for your generous response, Stephen. Looking at it now.
Copy link to clipboard
Copied
OK, I did as you instructed:
Copied code into Mac text file set to txt and not rich text.
Changed .txt extension to .jsx extension
I placed it into Adobe Photoshop 2024/Presets/Scripts
Tried to load the script because it does not show up in the image processor script menu.
But when I tried to load the script, it became a dead end. See examples.
For some context, I know nothing about scripting or batch commands. I just need to get bunch of images into Webp format for my website.
Any thoughts?
Copy link to clipboard
Copied
The script is correctly loaded, your screenshot shows that you named it as WebP_Script. It isn't meant to be visible under Image Processor. There should be no need to browse manually.
The input folder that you select must contain supported file types (PSD, TIFF, JPEG etc) for saving as WebP to the selected output folder. What file extensions are in the input folder?
Copy link to clipboard
Copied
Please accept my gratitude, Stephen. This was of tremendous help to me, and if you lived in LA, I would buy you beer.
I have one last question. If I open the script and change the following two code lines from 75 to 100, will it save at 100% ?
// Save as a copy and close
saveWebP("compressionLossy", 75, true, true, true, true);
activeDocument.close(SaveOptions.DONOTSAVECHANGES);
// Save as a copy and close
saveWebP("compressionLossy", 75, true, true, true, true);
activeDocument.close(SaveOptions.DONOTSAVECHANGES);
Copy link to clipboard
Copied
Changing from 75% lossy to 100% lossy, yes – not lossless.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
@ianamalod – the error screenshot has the clue "rtf"...
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Text Editor Applications: Only paste the source code into plain text editors, not rich text or word processing apps. Common free or commercial plain text editors suitable for code saving include –
Mac: Apple TextEdit (ensure that the Format menu is set to Plain Text mode, not Rich Text mode), BBEdit
Copy link to clipboard
Copied
Hey! thank you for your quick response 🙂 Yes, I read your doc. I used apple text edit, and saved as txt, then renamed it and changed the extension to jsx. Would you mind telling me what could've gone wrong? Thanks again!
Copy link to clipboard
Copied
Hey! thank you for your quick response 🙂 Yes, I read your doc. I used apple text edit, and saved as txt, then renamed it and changed the extension to jsx. Would you mind telling me what could've gone wrong? Thanks again!
By @ianamalod
It's all in my previous reply, i.e.:
Mac: Apple TextEdit (ensure that the Format menu is set to Plain Text mode, not Rich Text mode), BBEdit
Copy link to clipboard
Copied
omg! it worked! very much thanks!!!!!!! plain text was the thing. Have a very nice rest of the week!!! Made my day!
Copy link to clipboard
Copied
On the Mac, I advise using BBEdit or a dedicated scripting IDE tool (not AppleScript Editor for ExtendScript JavaScript) to avoid such issues and to take advantage of more powerful text editing features. Granted this may be considered overkill by those only wishing to save code without editing it.
Copy link to clipboard
Copied
BBEdit has a free mode and is arguably the best text editor available on any platform. I highly recommend it to any Mac user.
Copy link to clipboard
Copied
Hi Stephen, thanks so much for this script. Super helpful. If I wanted to the webp files to save without exif, xmp data, and ps data where would I edit the code?
Copy link to clipboard
Copied
First, I exported my RAW images fas JPEGs from LightRoom, where I excluded EXIF, XMP, and metadata. Then, from those jpegs, I used Stephan's PS script to export the JPEGs as WebP files. Worked like a charm.
Copy link to clipboard
Copied
First, I exported my RAW images fas JPEGs from LightRoom, where I excluded EXIF, XMP, and metadata. Then, from those jpegs, I used Stephan's PS script to export the JPEGs as WebP files. Worked like a charm.
By @Sanpanza
That obviously works, but I personally would save into a lossless compression and file format rather than JPEG, considering that the WebP is going to apply further lossy compression again.
Copy link to clipboard
Copied
So you export directly from Tiff or PSD formats?
Copy link to clipboard
Copied
So you export directly from Tiff or PSD formats?
By @Sanpanza
That would be better than as an intermediate format than using JPEG format (as long as TIFF doesn't include lossy JPEG compression, LZW and ZIP are OK as they are lossless).
Copy link to clipboard
Copied
Thanks again, Stephen!!!
Copy link to clipboard
Copied
@Sanpanza – I could write a version of the script to save open documents in Photoshop, that way you don't have to save raw file renders to an intermediate format first.
Copy link to clipboard
Copied
Hi Stephen, thanks so much for this script. Super helpful. If I wanted to the webp files to save without exif, xmp data, and ps data where would I edit the code?
By @bovinejoni
Change the first 3 values of true to false in both function calls as per this annotated screenshot of the code:
Let me know how you go, good luck!