增加UI配置项
This commit is contained in:
40
Pictures/批量修改为sRGB图片.ps1
Normal file
40
Pictures/批量修改为sRGB图片.ps1
Normal file
@@ -0,0 +1,40 @@
|
||||
# 配置图片根目录(已填写你的路径)
|
||||
$rootDirectory = ".\"
|
||||
|
||||
# 要处理的图片格式(仅处理PNG,可根据需要添加其他格式)
|
||||
$imageExtensions = @("*.png")
|
||||
|
||||
# ImageMagick的magick命令路径(默认安装路径,需根据实际安装情况修改)
|
||||
$magickPath = "D:\Application\ImageMagick-7.1.2-Q16-HDRI\magick.exe"
|
||||
|
||||
# 检查magick.exe是否存在
|
||||
if (-not (Test-Path $magickPath)) {
|
||||
Write-Host "错误:未找到magick.exe,请检查ImageMagick安装路径是否正确!" -ForegroundColor Red
|
||||
Write-Host "提示:默认路径为C:\Program Files\ImageMagick-版本号\magick.exe" -ForegroundColor Yellow
|
||||
exit
|
||||
}
|
||||
|
||||
# 递归查找所有图片文件
|
||||
$imageFiles = Get-ChildItem -Path $rootDirectory -Include $imageExtensions -Recurse -File
|
||||
|
||||
if ($imageFiles.Count -eq 0) {
|
||||
Write-Host "未找到任何图片文件" -ForegroundColor Yellow
|
||||
exit
|
||||
}
|
||||
|
||||
# 批量处理图片
|
||||
foreach ($file in $imageFiles) {
|
||||
Write-Host "正在处理: $($file.FullName)"
|
||||
|
||||
# 使用magick命令,路径添加引号处理特殊字符
|
||||
& $magickPath "$($file.FullName)" -strip "$($file.FullName)"
|
||||
|
||||
# 检查处理结果
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "✅ 处理成功: $($file.Name)" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "❌ 处理失败: $($file.Name)" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "`n处理完成,共处理了 $($imageFiles.Count) 个文件" -ForegroundColor Cyan
|
||||
Reference in New Issue
Block a user