Last active
February 3, 2024 01:13
-
-
Save christippett/42b3addd349cc30dba879d2e2cd701ce to your computer and use it in GitHub Desktop.
Split Midjourney image grid into individual images
This file contains hidden or 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
#!/bin/sh | |
set -e | |
ext=".$(basename "$1" | rev | cut -d'.' -f1 | rev)" | |
fname="$(basename "$1" "$ext")" | |
width="$(identify -format "%w" "$1")" | |
height="$(identify -format "%h" "$1")" | |
w="$((width / 2))" | |
h="$((height / 2))" | |
magick "$1" -crop "$w"x"$h"+0+0 "${fname}-1${ext}" | |
magick "$1" -crop "$w"x"$h"+"$w"+0 "${fname}-2${ext}" | |
magick "$1" -crop "$w"x"$h"+0+"$h" "${fname}-3${ext}" | |
magick "$1" -crop "$w"x"$h"+"$w"+"$h" "${fname}-4${ext}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment