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来使用它的命令提示符,但是没用!
有没有人可以帮助我?
有谁知道在不损失图像质量的前提下减小图像尺寸的任何工具?
从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)
| 归档时间: |
|
| 查看次数: |
1696 次 |
| 最近记录: |