Created
July 29, 2020 14:09
-
-
Save TobiasPott/213a758d4bb7f91f7f91bfa5b0250756 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo off | |
if [%1]==[] ( | |
echo No path given as parameter | |
exit /b | |
) else ( | |
set basePath=%1 | |
set imPath="C:\Program Files\ImageMagick\7.0.10-Q16-HDRI\magick.exe" | |
) | |
set folderPathTif=%basePath%*.tif | |
set folderPathPng=%basePath%*.png | |
REM set folderPathJpg=%basePath%"*.jpg" | |
REM set folderPathJpeg=%basePath%"*.jpeg" | |
set folders=(%folderPathTif%, %folderPathPng%) | |
REM for %%f in (%folderPathTif%, %folderPathPng%, %folderPathJpg%) do ( | |
for %%f in %folders% do ( | |
setlocal enabledelayedexpansion | |
set ext=%%~xf | |
REM ! indicated delayed expansion which causes the variable to contain the correct extension value | |
if "!ext!"==".png" ( | |
echo PNG %%~nf | |
REM do not use specific compression | |
%imPath% "%%f" -channel RGBA -separate -resize 50%% -combine "%%f" | |
) | |
if "!ext!"==".tif" ( | |
echo TIFF %%~nf | |
%imPath% "%%f" -channel RGBA -separate -resize 50%% -combine -compress lzw "%%f" | |
) | |
endlocal | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment