Skip to content

Instantly share code, notes, and snippets.

@seb776
Last active December 21, 2021 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seb776/24b1aafd699247973dbc89c7828789da to your computer and use it in GitHub Desktop.
Save seb776/24b1aafd699247973dbc89c7828789da to your computer and use it in GitHub Desktop.
Batch using imagemagick to assemble a Quilt for looking glass
@echo off
set quiltColumns=8
set quiltRows=6
set magickPath="magick.exe"
setlocal
set "psCommand="(new-object -COM 'Shell.Application')^
.BrowseForFolder(0,'Please choose a folder.',0,0).self.path""
for /f "usebackq delims=" %%I in (`powershell %psCommand%`) do set "folder=%%I"
setlocal enabledelayedexpansion
set outPath=!folder!\OutQuilt_%quiltColumns%x%quiltRows%.png
IF EXIST "%outPath%" (
echo Found previous quilt at "%outPath%"
del "%outPath%"
)
set filesPath=!folder!\*.png
echo Your files for quilt "%filesPath%"
echo Your output quilt is "%outPath%"
echo:
echo Generating your quilt...
%magickPath% montage -flip -tile %quiltColumns%x%quiltRows% -geometry +0+0 -border 0 "%filesPath%" "%outPath%"
%magickPath% convert "%outPath%" -flip "%outPath%"
echo:
echo Quilt generated at %outPath%
endlocal
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment