Skip to content

ErcanOPAK.com

  • ASP.Net WebForms
  • ASP.Net MVC
  • C#
  • SQL
  • MySQL
  • PHP
  • Devexpress
  • Reportviewer
  • About
Windows

How to convert JPG or PNG to WebP in batch or single mode

- 12.11.23 - ErcanOPAK

To convert JPG or other image formats to WebP, you can use the WebP command line converter tool provided by Google. You can download the WebP converter tool from https://developers.google.com/speed/webp/download (Click Download for Windows).

Once downloaded, extract the folder to C:\ directory or wherever else you like (you will need the path to converter tool later). After extracting the folder, open Command Prompt with administrator rights.

Run Command Prompt as Administrator Windows 11

In the command prompt window, enter cd "path to the converter tool's bin folder" and press Enter, for example, cd C:\libwebp-1.2.4-windows-x64\bin.

Command Prompt convert WebP Windows 11

Next, enter the following command line to convert a JPG image (or other image format) to WebP format.

cwebp.exe -q [quality number] [path to the image you want to convert] -o [path to save the converted image]

For example, the command line below will convert the image in C:\images\Bali.jpg with quality set as 50 (with 0 being the worst, 100 being the best quality, and 75 being the default value if not specified) and save the converted image as C:\images\Bali.webp.

cwebp.exe -q 50 c:\images\Bali.jpg -o c:\images\Bali.webp

How to convert JPG or PNG to WebP

After executing the command line, you can find the converted WebP image in the directory you have entered in the executed command line.

Convert JPG to WebP

Batch convert JPG to WebP

To bulk convert JPG or other image format to WebP, follow the steps in the “Batch convert WebP to JPG” section above until the step where you need to enter command line. Then, use the command lines below instead to convert JPG to WebP. To enter multiple lines of commands, press Shift + Enter to go to next line without executing the command.

$dir = "c:\images"
$images = Get-ChildItem $dir
foreach ($img in $images) {
$outputName = $img.DirectoryName + "\" + $img.BaseName + ".webp"
C:\libwebp-1.2.4-windows-x64\bin\cwebp.exe $img.FullName -o $outputName
}

Replace C:\images with the actual directory where the images you want to convert are stored. In addition, replace C:\libwebp-1.2.4-windows-x64\bin\cwebp.exe with the actual path to the webp.exe tool which you have extracted earlier.

Batch convert JPG to WebP

The command lines above will convert all images in the C:\images folder, regardless of their formats, to WebP format using the cwebp.exe tool.

After executing the command, you can see the conversion progress directly in the Windows Terminal as it converts the images to WebP format. Once the WebP conversion is completed, you can find the converted images in the same folder where the original images are stored.

Thanks to WindowsDigitals.com for such a great article.

Related posts:

How To Select Pro Edition While Installing Windows 10
Essential Steps to Take After Windows 11 Updates
How to solve 0xc0000135 application errors after Windows 11 Update
How to Reset Taskbar in Windows 11
Post Views: 52

Post navigation

How to get the first and the last day of previous month in SQL Server
How to find a specific text string in a SQL Server Stored Procedure, Function, View or Trigger

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

October 2024
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
28293031  
« Sep    

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (848)
  • Get the First and Last Word from a String or Sentence in SQL (756)
  • How to select distinct rows in a datatable in C# (703)
  • How to add default value for Entity Framework migrations for DateTime and Bool (584)
  • Add Constraint to SQL Table to ensure email contains @ (521)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (480)
  • How to make theater mode the default for Youtube (465)
  • Average of all values in a column that are not zero in SQL (453)
  • Find numbers with more than two decimal places in SQL (383)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (371)

Recent Posts

  • How to Reset Taskbar in Windows 11
  • Essential Steps to Take After Windows 11 Updates
  • How to list all tables referencing a table by Foreign Key in MS SQL
  • How to format date in Javascript
  • How to generate a random number for each row in T-SQL
  • How to solve ‘Microsoft.TeamFoundation.Git.Contracts.GitCheckoutConflictException’ problem
  • Why nautical mile equals 1852 mt
  • How to Find Day Name From Date in SQL Server
  • How to make pagination in MS SQL Server
  • How to update Identity Column in SQL Server

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (848)
  • Get the First and Last Word from a String or Sentence in SQL (756)
  • How to select distinct rows in a datatable in C# (703)
  • How to add default value for Entity Framework migrations for DateTime and Bool (584)
  • Add Constraint to SQL Table to ensure email contains @ (521)

Recent Posts

  • How to Reset Taskbar in Windows 11
  • Essential Steps to Take After Windows 11 Updates
  • How to list all tables referencing a table by Foreign Key in MS SQL
  • How to format date in Javascript
  • How to generate a random number for each row in T-SQL

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter

© 2024 ErcanOPAK.com

Proudly powered by WordPress | Theme: Xblog Plus by wpthemespace.com