All pastes #799971 Raw Edit

DOS batch file for pncrush autom

public text v1 · immutable
#799971 ·published 2007-11-28 00:31 UTC
rendered paste body
@ECHO OFF
IF "%1"=="" GOTO nofileerror
IF NOT EXIST %1 GOTO nofileerror
GOTO crushfile

:nofileerror
ECHO Please specify a valid input file.
GOTO end

:crushfile
ECHO Crushing %1 by dropping all colour profile data ...
copy %1 original_%1

REM -q = quiet mode (pngcrush won’t print to the screen)
REM -rem = remove data chunk
REM gAMA = Gamma correction
REM cHRM = Device-independent colours
REM iCCP = Embedded ICC profile
REM sRGB = Standard RGB colour space
REM tEXt, zTXt = Various textual metadata

pngcrush.exe -q -rem gAMA -rem cHRM -rem iCCP -rem sRGB -rem tEXT -rem zTXt original_%1 crushed_%1
IF EXIST crushed_%1 move crushed_%1 %1
IF %ERRORLEVEL% NEQ 0 GOTO error
ECHO.
ECHO Success! An unmodified copy can be found at original_%1.
ECHO Feel free to delete the original if it's no longer needed.
GOTO end

:error
ECHO There was an error somewhere in the process. Is your input file valid?

:end