Skip to main content
Participating Frequently
December 18, 2023
Question

Fastest way to exporting as webp in photoshop

  • December 18, 2023
  • 5 replies
  • 2298 views

Hi 

im working with alot of files  like ( 100 images per day) and i export them as a webp 

it take a long time to export each one i need to press 

file>save as a copy >webp>save

is there any way to make it faster or easier like a shortcut 

or a plugin to let me save as a webp with one button?

5 replies

Stephen Marsh
Community Expert
Community Expert
December 21, 2023

@MZAMA232167518ylr 

 

So, where are you at with this?

Stephen Marsh
Community Expert
Community Expert
December 18, 2023

@MZAMA232167518ylr 

 

As you want to have the ability to manually name files and handle overwriting files of the same name, the easiest way is to use a script which uses the native Save a Copy interface, defaulting to use the active document path. This means that the WebP option window will pop up every time as that is part of the Save a Copy process, just as the Save a Copy dialog that you need for file naming flexibility is also a part of the same process. 

 

If you don't wish to have the WebP options dialog come up, then a modification of the script would be required to disable the native dialog and add a prompt for providing a filename.

 

/*
Save A Copy as WebP.jsx
v1.0 - 19th December 2023, Stephen Marsh
v1.0B - 10th February 2024 - Added a check for RGB mode, otherwise the save would silently fail
https://community.adobe.com/t5/photoshop-ecosystem-discussions/fastest-way-to-exporting-as-webp-in-photoshop/m-p/14304703
*/

#target photoshop

    (function () {

        // Ensure that version 2022 or later is being used
        var versionNumber = app.version.split(".");
        var versionCheck = parseInt(versionNumber);

        // Fail
        if (versionCheck < 23) {
            alert("You must use Photoshop 2022 or later to save using native WebP format...");

        // Pass
        } else {

            // Fail
            if (activeDocument.mode !== DocumentMode.RGB) {
                alert("The current document mode isn't RGB!");

            // Pass
            } else {

                try {
                    var outputPath = activeDocument.path.fsName;
                } catch (e) {
                    var outputPath = Folder.selectDialog("Unsaved file, select the output folder:");
                }
                var WebPDocName = activeDocument.name.replace(/\.[^\.]+$/, '');
                saveWebP(100, false, false, false, new File(outputPath + "/" + WebPDocName + ".webp"), true, true);
                app.beep();
            }
        }

        function saveWebP(quality, includeXMPData, includeEXIFData, includePsExtras, saveTo, copy, lowerCase) {
            function s2t(s) {
                return app.stringIDToTypeID(s);
            }
            var descriptor = new ActionDescriptor();
            var descriptor2 = new ActionDescriptor();
            descriptor2.putEnumerated(s2t("compression"), s2t("WebPCompression"), s2t("compressionLossy"));
            descriptor2.putInteger(s2t("quality"), quality);
            descriptor2.putBoolean(s2t("includeXMPData"), includeXMPData);
            descriptor2.putBoolean(s2t("includeEXIFData"), includeEXIFData);
            descriptor2.putBoolean(s2t("includePsExtras"), includePsExtras);
            descriptor.putObject(s2t("as"), s2t("WebPFormat"), descriptor2);
            descriptor.putPath(s2t("in"), saveTo);
            descriptor.putBoolean(s2t("copy"), copy);
            descriptor.putBoolean(s2t("lowerCase"), lowerCase);
            descriptor.putEnumerated(s2t("saveStage"), s2t("saveStageType"), s2t("saveSucceeded"));
            executeAction(s2t("save"), descriptor, DialogModes.ALL);
        }

    }());

 

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

Stephen Marsh
Community Expert
Community Expert
December 18, 2023

@MZAMA232167518ylr 

 

This 1.2 version does not offer the WebP options dialog, however, it does offer a prompt for providing a filename. This should remove one step.

 

/*
Save A Copy as WebP.jsx
v1.1 - 19th December 2023, Stephen Marsh
v1.2 - 10th February 2024 - Added a check for RGB mode, otherwise the save would silently fail
https://community.adobe.com/t5/photoshop-ecosystem-discussions/fastest-way-to-exporting-as-webp-in-photoshop/m-p/14304703
*/

#target photoshop

    (function () {

        // Ensure that version 2022 or later is being used
        var versionNumber = app.version.split(".");
        var versionCheck = parseInt(versionNumber);

        // Fail
        if (versionCheck < 23) {
            alert("You must use Photoshop 2022 or later to save using native WebP format...");

        // Pass
        } else {

            // Fail
            if (activeDocument.mode !== DocumentMode.RGB) {
                alert("The current document mode isn't RGB!");

            // Pass
            } else {
                try {
                    var outputPath = activeDocument.path.fsName;
                } catch (e) {
                    var outputPath = Folder.selectDialog("Unsaved file, select the output folder:");
                }
                var docName = activeDocument.name.replace(/\.[^\.]+$/, '');
                var docNameInput = prompt('Enter a filename (without extension):', docName);
                var WebPDocName = docNameInput.replace(/\.[^\.]+$/, '');
                var saveFileWebP = new File(outputPath + "/" + WebPDocName + ".webp");
                if (saveFileWebP.exists) {
                    if (!confirm("File exists, overwrite: Yes or No?", true))
                        throw null;
                }
                saveWebP(100, false, false, false, new File(saveFileWebP), true, true);
                app.beep();
            }
        }

        function saveWebP(quality, includeXMPData, includeEXIFData, includePsExtras, saveTo, copy, lowerCase) {
            function s2t(s) {
                return app.stringIDToTypeID(s);
            }
            var descriptor = new ActionDescriptor();
            var descriptor2 = new ActionDescriptor();
            descriptor2.putEnumerated(s2t("compression"), s2t("WebPCompression"), s2t("compressionLossy"));
            descriptor2.putInteger(s2t("quality"), quality);
            descriptor2.putBoolean(s2t("includeXMPData"), includeXMPData);
            descriptor2.putBoolean(s2t("includeEXIFData"), includeEXIFData);
            descriptor2.putBoolean(s2t("includePsExtras"), includePsExtras);
            descriptor.putObject(s2t("as"), s2t("WebPFormat"), descriptor2);
            descriptor.putPath(s2t("in"), saveTo);
            descriptor.putBoolean(s2t("copy"), copy);
            descriptor.putBoolean(s2t("lowerCase"), lowerCase);
            descriptor.putEnumerated(s2t("saveStage"), s2t("saveStageType"), s2t("saveSucceeded"));
            executeAction(s2t("save"), descriptor, DialogModes.NO);
        }

    }());

 

 

 

didiermazier
Community Expert
Community Expert
December 18, 2023

Hi

You could :

  1. Record an action for saviing as webp
  2. Use this action in the file > scripts> image processor (4)

 

Stephen Marsh
Community Expert
Community Expert
December 18, 2023

Actions and Scripts are the common forms of automation where keyboard shortcuts can be applied... That being said, more info would be required to offer more than generic advice.

 

General items for consideration (some may or may not apply to WebP)?:

 

* WebP compression - lossless or lossy. If lossy, what quality % value?

 

* WebP metadata, exclude or include? If include, XMP, EXIF and or Photoshop?

 

* Save As or Save a Copy?

 

* File name? Use the current file name or something else (prefix, suffix etc).

 

* Save location? Same as the original file or to a fixed/static location such as the desktop?

 

* Silently overwrite files with the same name/extension or prompt to overwrite?

 

* Convert to 8-bpc?

 

* Remove alpha channels?

 

* Convert non-RGB images to RGB?

 

* Convert non-sRGB images to sRGB or something else such as P1?

 

* Something else that I haven't considered?

 

 

 

Participating Frequently
December 18, 2023

WebP compression -lossy 100%
(WebP metadata, exclude or include? If include, XMP, EXIF and or Photoshop)  NO
Save a Copy with any file name 
Save location- Same as the original file
no overwrite i need to keep everthing 
Convert to 8-bpc- no
Remove alpha channels - no 
Convert non-RGB images to RGB - no 
 Convert non-sRGB images to sRGB or something else such as P1 - no
Something else that I haven't considered -no

kglad
Community Expert
Community Expert
December 18, 2023

in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



<"moved from using the community">