3

I would like to know if there is a way to add 'Save As WebP' image file format to windows 10 right click context menu. Through the registry. WebP images are a new file format that is designed specifically for the web. Which has up to 30% better compression than Jpg or Png. It Also compresses with better loss reduction compared to the other image file formats. Can anyone suggest if this is possible? or show me how I would do this through the registry.

Version 1903 OS Build 18362.239

I know that it is possible to add your own commands to the right click menu as I have done it before through the registry to add Take ownership of a file to the menu.

  • Where do you want to show that option? In browser? – Biswapriyo Jul 24 '19 at 16:56
  • Yes both in the browser & generally through-out my windows system aswell if possible I am using Firefox Developer edition 68 if this info helps. But Just browser if Not Available. – Ryan Stone Jul 24 '19 at 17:23
  • I know That custom context menu items, are possible through the registry, just wondering if theres any code to enable WebP – Ryan Stone Jan 29 at 5:16
  • 1
    Adding a menu item through the registry does nothing more than run a command from a right click.. passing the path of the thing that was clicked. You need to start with an application that takes some other image type and converts it to WebP format via command line. Start there, otherwise this conversation is pointless. – Señor CMasMas Mar 10 at 21:35
  • @Señor CMasMas exactly it could run a command to pass the image through a program and return the resulting image. – Ryan Stone Mar 10 at 21:37
3
+100

This can be done by downloading the official cwebp command line encoder from Google, and then adding its bin folder to your PATH (environment variable). Then, create a batch file that takes a file and runs it through cwebp with your preferred settings. Finally, use a .reg file or a downloaded utility, such as Easy Context Menu, to add your batch file to the right-click context menu for files.

Step 1: Download and extract libwebp from Google

(64-bit) Offical Download for libwebp Version 1.1.0

(32-bit) Offical Download for libwebp Version 1.0.3

Extract the folder to your preferred location and take note of the folder path so that we can use it in Step 2.

Step 2: Add libwebp's bin folder to your PATH

Open the Run Dialog box by pressing WinKey+R. Alternatively, right-click on the Start button and left-click on Run. Type the following:

SystemPropertiesAdvanced

Press Enter.

The "System Properties" Dialog opens with the "Advanced" tab selected.

Press the "Environment Variables..." Button located after the Startup and Recovery section at the bottom right. The "Environment Variables" dialog opens.

In the "User Variables for " section at the top, left-click the list item that has "Path" listed in the Variable column. Click the Edit button underneath the "User Variables for " list box. The Edit Environment Variable dialog opens.

Click New on the top right to add an entry. Type or paste in the location of libwebp's bin folder that we extracted in Step 1.

If the folder was extracted inside a user's download folder, and that user was named "Administrator", then the folder location string would look like the following:

C:\Users\Administrator\Downloads\libwebp-1.1.0-windows-x64\bin

After ensuring the path is correct, press enter.

Click OK on the "Edit Environment Variable" Dialog.

Click OK on the "Environment Variables" Dialog.

Click OK on the "System Properties" Dialog.

The location of libwebp's bin folder has now been added to your PATH (environment variable.)

Step 3: Create a batch file that converts a file to .webp using cwebp

In this step we will be creating a batch file that looks something like this:

cwebp -q 50 -m 6 -af -f 50 -sharpness 0 -mt -v -progress %1 -o %~n1.webp

Explanation

cwebp This references a specific executable file located in our libwebp's bin folder that can convert images to webp.

-q 50 The "compression factor for RGB channels between 0 and 100" Here we use 50 for moderate compression.

-m 6 The compression method with values ranging from 0 to 6. 6 is the maximum so we get the smallest file size.

-af Turns auto-filter on. Gives us optimized quality.

-f 50 Deblocking filter (Smoothness) (0-100)

-sharpness 0 Sharpness range with 0 being the most sharp and 7 being the least sharp

-mt Use multi-threading for encoding, if possible.

-v Print extra information (encoding time in particular).

For more information on command line switches that you can use with cwebp, see Google's WebP Guide on cwebp

%1 is the first argument supplied to the batch file, in this case, it will be the file we selected and right-clicked in Windows Explorer.

We include the final switch:

-o %~n1.webp

where -o tells cwebp to write out to a file, %~n1 prints the name of the original file without the file extension, to which we add our new extension .webp

Important: Save this file with a .bat file extension in a location where the current user has permissions to access and execute it. In our example, the current user's downloads folder will be used and the file is named webp.bat. This is the example path to our batch file:

C:\Users\Administrator\Downloads\webp.bat

Step 4: Modify the System's Right Click context menu for files

If you are comfortable editing your systems registry, and you know how to create a backup of it, you may find option 1 suitable. If not, option 2 provides a safer way to modify your system.

Option 1: Modify the registry

In this step we create and run a .reg file that looks like this:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Run script]
@="Run &script"

[HKEY_CLASSES_ROOT\*\shell\Run script\command]
@="\"C:\\Users\\Administrator\\Downloads\\webp.bat\" \"%1\""

Explanation

HKEY_CLASSES_ROOT\*\shell\Run script

Adds an entry into the context-menu for all files on the system named Run script

@="Run &script"

Here we have the name that shows in the context menu. The & symbol denotes which key on the keyboard the user can press to access this context-menu entry

HKEY_CLASSES_ROOT*\shell\Run script\command

Here is the command for our previous entry under the name Run script

@="\"C:\Users\Administrator\Downloads\webp.bat\" \"%1\""

This is the path to our saved batch file from step 3.

Option 2: Use Easy Context Menu v1.6

You can download Easy Context Menu v1.6 here.

Once you have downloaded, extracted, and opened EcMenu.exe or EcMenu_x64.exe, depending on your system (32-bit or 64-bit), press Ctrl+E to open the "List Editor" dialog. Alternatively, you can click on the File menu and click on the third option which is "List Editor"

The "List Editor" dialog appears, scroll down to File Context Menu and left-click on it. Then press the "Add New" button at the bottom of the window. The File selection dialog appears.

Navigate to the folder where you saved the batch file in Step 3. For our example we navigate to our Downloads folder. Change the type of files shown in the dialogs file list from "Application Files (*.exe)" to "Application Files (*.*)" by left clicking on the dropdown box at the bottom right above the open button. Double left-click on the batch file. In our example, this file is named webp.bat.

You can change some of the settings like where it will be displayed in the context menu.

Once you are done, press the "Save Changes" button at the bottom left and close the "List Editor" dialog.


I have tested this solution myself, on my Windows 10 Pro 1903 using Option 2 in Step 4, using the Easy Context Menu utility. I can right-click on files and use the context menu to convert them to webp. The command window pops open with the progress and it closes when it is done, and I have a new file that is the same image, but in webp format.

| improve this answer | |
  • Most comprehesive & in-depth answer ever, thanks for your input. Just gave you the bounty. Enjoy. – Ryan Stone Mar 12 at 9:48
1

Install the free and open source tool of File Converter. Once installed, it appears in the context (right click) menu.

To use, select one or several file(s) in Windows File Explorer, right-click on one of the selected files (or on any file if none are selected), choose File Converter and select the file format. A window opens showing the progress of the conversion and closes when it's complete. Converted files are stored in the same folder as the source file with the same name but with a different extension.

File Converter works with audio, video, image and document files and supports many formats that you may choose through its Settings dialog.

For a review, see the article Convert Files With A Right Click In Windows Explorer.

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.