power shell_ffmpeg 图片缩放
2024-03-14 本文已影响0人
zip11
ps1_ffmpeg 图片缩放
图片缩小 到 48*48 大小,ico大小
# 从键盘读取图片的路径
$InputPath = Read-Host "请输入图片路径"
# 获取文件扩展名
$Extension = [System.IO.Path]::GetExtension($InputPath)
# 获取图片所在文件夹路径
$DirectoryName = [System.IO.Path]::GetDirectoryName($InputPath)
# 获取不带扩展名的图片文件名
$FileNameWithoutExtension = [System.IO.Path]::GetFileNameWithoutExtension($InputPath)
# 创建新图片的完整路径,文件名后添加_48x48,并保持原始扩展名
$OutputPath = [System.IO.Path]::Combine($DirectoryName, "${FileNameWithoutExtension}_48x48$Extension")
# 调用FFmpeg进行图片尺寸缩放
ffmpeg -i $InputPath -vf "scale=48:48" $OutputPath
# 输出结果
Write-Host "新的缩放图片已保存至: $OutputPath"