Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert my photos to webp format of Google in windows 8.1?

I want to convert my photos from jpg, gif, and png to WebP format.

When I'm trying to use CMD for using cwebp command, I got this error message :

'cwebp' is not recognized as an internal or external command, operable program or batch file.

What should do I do?

I've downloaded all the files needed such as libwebp-0.4.0-windows-x86.zip and WebpCodecSetup.exe.

Even I've installed Visual Studio to use its command prompt, but didn't work! Is there anyone who can help me?

One more question:

Is anyone know any tool to reduce image size without losing its quality?

like image 765
Hosein Avatar asked Jun 30 '14 06:06

Hosein


People also ask

How do I save an image as WebP?

Create or edit an image using Photoshop, then click Save As. Save the file as a WebP using the Format menu. Choose the name and location for your new WebP file and click Save. A settings panel will appear, giving you the option to edit your file further.

How do I convert to WebP?

Right click on an image file or a folder containing a number of images files, and then click Convert to WebP.


2 Answers

Download cwebp binaries (.exe) and run it with PowerShell:

# tip: on windows explorer shift + right-click a directory and copy its path
$dir = "path/to/photos/directory"

# get all files in the directory
$images = Get-ChildItem $dir

foreach ($img in $images) {
  # output file will be written in the same directory 
  # but with .webp extension instead of old extension
  $outputName = $img.DirectoryName + "\" + $img.BaseName + ".webp"

  C:\webp-converter\libwebp-0.6.1-windows-x64\bin\cwebp.exe $img.FullName -o $outputName
}

See also cwebp options.

like image 90
pldg Avatar answered Sep 28 '22 00:09

pldg


To convert any image format to webp from Windows command line (CMD)

Download latest webp release from this page

I downloaded this package because my system is a 32 bit windows 10

Extract it and set environmental variable (follow below steps)

Click start button type "view advanced system settings" and open it (this step may differ in win xp or win 7) Click Environment Variables>User Variables>New>Variable Name:path Variable Value:C:\libwebp-1.0.2-windows-x86\bin

Now open CMD > Go to Image folder run following command

cwebp -q 50 -m 6 -af -f 50 -sharpness 0 -mt -v -progress source_img.jpg -o converted.webp
like image 21
Mylsel Avatar answered Sep 28 '22 02:09

Mylsel