¿Cómo puedo convertir por lotes varias carpetas de imágenes a PNG8?

¿Cómo puedo convertir por lotes varias carpetas de imágenes a PNG8?

Tengo más de 4500 imágenes PNG 24 en más de 20 carpetas cuyo tamaño deseo reducir convirtiéndolas a PNG 8. (Aparte: probé smushing y otras optimizaciones de png pero los ahorros no son suficientes, una prueba de 2 carpetas en PS mostraron que PNG 8 no debería tener una degradación significativa de las imágenes)

Cuando probé PS CS3 Batch, no guardaba los originales y los archivos nuevos que crea no tienen estructura de carpetas. ¿Hay alguna manera de arreglar esta u otra herramienta para el trabajo?

Estoy ejecutando OSX pero tengo acceso a Windows XP/7.

Respuesta1

XnViewmaneja el procesamiento/conversión por lotes. Ctrl+ U: "Herramientas -> Procesamiento por lotes..."

  • Opciones para sobrescribir, usar la ruta original (como salida) y/o mantener la estructura de subcarpetas.
  • Agregue la transformación "Convertir > Convertir a colores" desde la pestaña Transformaciones. Uno de los parámetros es bits/píxel.

Respuesta2

Eso es un dolor ¿no? Aquí está el truco. Después de grabar sus acciones para convertirlas en png8, haga clic en la esquina superior derecha de la paleta de acciones y elija insertar elemento de menú. Luego simplemente haga clic en archivo --> guardar. Haga clic en Aceptar. Ahora debería ser el último subelemento de su acción.

Ahora, cuando ejecuta el lote, las cosas permanecen en su subcarpeta como se supone que deben hacerlo.

Respuesta3

Instale ImageMagick y ejecútelo con 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
} 

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

 

información relacionada