如何在Windows 8.1中将照片转换为Google的webp格式?

Hos*_*nBL 4 powershell cmd image-processing image-compression webp

我想将我的照片从jpg,gif和png转换为WebP格式!当我尝试使用CMD使用cwebp命令时,出现以下错误消息:

'cwebp' 不被识别为内部或外部命令,可操作程序或批处理文件。

我该怎么办?

我已经下载了所有需要的文件,例如libwebp-0.4.0-windows-x86.zip和WebpCodecSetup.exe(从此url:“ https://code.google.com/p/webp/downloads/list ”) 。

甚至我已经安装了Visual Studio来使用它的命令提示符,但是没用!

有没有人可以帮助我?

另一个问题:

有谁知道在不损失图像质量的前提下减小图像尺寸的任何工具?

pld*_*ldg 5

从Google 下载cwebp二进制文件(.exe)后,可以使用PowerShell运行它。

将以下代码复制并粘贴到PowerShell中,然后按Enter键运行它。

阅读摘要中的评论以获取更多信息。

# on Windows Explorer, shift + right-click a directory and copy its path
# paste the path in $dir
$dir = "path/to/directory"

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

# loop through every images
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"

  # copy-paste the path to cwebp program 
  # and set its input and output parameters
  # more options https://developers.google.com/speed/webp/docs/cwebp
  C:\webp-converter\libwebp-0.6.1-windows-x64\bin\cwebp.exe $img.FullName -o $outputName
}
Run Code Online (Sandbox Code Playgroud)

  • 这不是愚人节的笑话,运行得很完美,如果确实将** bin **文件夹添加到PATH(Windows环境变量)中,则只需键入`cwebp -q 75 -m 6 -af -f 50 -sharpness 0- mt -v -progress $ img.FullName -o $ outputName`。 (2认同)