Adding DPI conversion to windows batch file
Posted: 2017-01-03T10:26:28-07:00
Hello Magicians,
I have a windows batch file that I use to sort images based on their height/width and DPI. Currently, I run a photoshop script on the images first to convert them all to 200dpi. What I'd like to do, is remove that step from the process and have the batch file convert the images to 200 DPI for me. Is that possible? Here's what the batch file looks like:
I have a windows batch file that I use to sort images based on their height/width and DPI. Currently, I run a photoshop script on the images first to convert them all to 200dpi. What I'd like to do, is remove that step from the process and have the batch file convert the images to 200 DPI for me. Is that possible? Here's what the batch file looks like:
Code: Select all
@ECHO OFF
SETLOCAL
SET ACCEPTDIR=accepted
SET REJECTDIR=rejected
SET ACCEPTDIRWEB=accepted_web
IF NOT EXIST %ACCEPTDIR% MD %ACCEPTDIR%
IF NOT EXIST %REJECTDIR% MD %REJECTDIR%
IF NOT EXIST %ACCEPTDIRWEB% MD %ACCEPTDIRWEB%
FOR %%I IN ( *.jpeg *.jpg *.tiff *.tif *.png *.bmp) DO (
FOR /F "tokens=1,2,3,4" %%A IN ( 'convert "%%I" -format "%%[w] %%[h] %%[resolution.x] %%[resolution.y]" info:' ) DO (
IF EXIST "%%I" IF %%A GTR 1199 IF %%D GTR 199 MOVE "%%I" %ACCEPTDIR%
IF EXIST "%%I" IF %%B GTR 1199 IF %%D GTR 199 MOVE "%%I" %ACCEPTDIR%
IF EXIST "%%I" IF %%A GTR 1199 IF %%C GTR 199 MOVE "%%I" %ACCEPTDIR%
IF EXIST "%%I" IF %%B GTR 1199 IF %%C GTR 199 MOVE "%%I" %ACCEPTDIR%
IF EXIST "%%I" IF %%A GTR 378 IF %%D GTR 199 MOVE "%%I" %ACCEPTDIRWEB%
IF EXIST "%%I" IF %%B GTR 378 IF %%D GTR 199 MOVE "%%I" %ACCEPTDIRWEB%
IF EXIST "%%I" IF %%A GTR 378 IF %%C GTR 199 MOVE "%%I" %ACCEPTDIRWEB%
IF EXIST "%%I" IF %%B GTR 378 IF %%C GTR 199 MOVE "%%I" %ACCEPTDIRWEB%
IF EXIST "%%I" MOVE "%%I" %REJECTDIR%
)
)
FOR %%I IN ( *.eps *.gif *.pdf *.doc) DO (
IF EXIST "%%I" MOVE "%%I" %REJECTDIR%
)
EXIT /B