如何批次將多個資料夾中的映像轉換為PNG8?

如何批次將多個資料夾中的映像轉換為PNG8?

我在20 多個資料夾中有4500 多個PNG 24 映像,我希望透過將它們轉換為PNG 8 來減少大小。是一個測試PS 中的 2 個資料夾顯示 PNG 8 應該沒有明顯的影像品質下降)

當我嘗試 PS CS3 Batch 時,它不會保存原始文件,並且它創建的新文件沒有資料夾結構。有沒有辦法解決這個問題或使用其他工具來完成這項工作?

我正在運行 OSX,但可以存取 Windows XP/7。

答案1

XnView處理批次/轉換。Ctrl+ U: “工具 -> 批次...”

  • 覆蓋、使用原始路徑(作為輸出)和/或保留子資料夾結構的選項。
  • 從“轉換”選項卡新增“轉換 > 轉換為顏色”轉換。參數之一是位元/像素。

答案2

那很痛苦不是嗎?這就是竅門。記錄你的動作使其成為 png8 後,點擊動作調色板的右上角並選擇插入選單項目。然後只需點擊文件-->儲存。按一下“確定”。現在它應該是您操作中的最後一個子項目。

現在,當您執行批次時,內容會像預期的那樣保留在其子資料夾中。

答案3

安裝 ImageMagick 並使用 Powershell 運行

 
#--------------------------------------------------------------------

# Powershell script to recursively convert image formats
# Configuration
$srcfolder = "C:\test\Animals"
$destfolder = "C:\test\Animals"
#This ps1 file will add copy files to designated folder
#Do NOT use Mogrify or the original images will be deleted
$im_convert_exe = "convert.exe -density 300"
# with VECTOR files the density setting should come BEFORE the vector file
# or the image will be blurry.
# change src_filter to the format of the source files
$src_filter = "*.eps"
# change dest_ext to the format of the destination files
$dest_ext = "png"
$options = "-depth 8 -alpha off"
$logfile = "C:\temp\convert.log"
$fp = New-Item -ItemType file $logfile -force
$count=0
foreach ($srcitem in $(Get-ChildItem $srcfolder -include $src_filter -recurse))
{
    $srcname = $srcitem.fullname

    # Construct the filename and filepath for the output
    $partial = $srcitem.FullName.Substring( $srcfolder.Length )
    $destname = $destfolder + $partial
    $destname= [System.IO.Path]::ChangeExtension( $destname , $dest_ext )
    $destpath = [System.IO.Path]::GetDirectoryName( $destname )

    # Create the destination path if it does not exist
    if (-not (test-path $destpath))
    {
        New-Item $destpath -type directory | Out-Null
    }

    # Perform the conversion by calling an external tool
    $cmdline =  $im_convert_exe + " `"" + $srcname  + "`"" + $options + " `"" + $destname + "`" " 
    #echo $cmdline
    invoke-expression -command $cmdline

    # Get information about the output file    
    $destitem = Get-item $destname

    # Show and record information comparing the input and output files
    $info = [string]::Format( "{0} `t {1} `t {2} `t {3} `t {4} `t {5}", $count, 
    $partial, $srcname, $destname, $srcitem.Length ,  $destitem.Length)
    echo $info
    Add-Content $fp $info

    $count=$count+1
} 

#--------------------------------------------------------------

 

相關內容