Last active
May 8, 2022 03:48
-
-
Save r6m/190d86a91b712cffd652a0fe9af780a7 to your computer and use it in GitHub Desktop.
split image by width using imagemagic
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
function slice() { | |
local slice_width="${SLICEW:-1080}" | |
local width=$(identify -format "%[w]" $1) | |
local slices=$(($width/$slice_width)) | |
local name="${1%.*}" | |
echo -e "slice ($slices x $slice_width) for image $1" | |
convert -crop "${slices}x1@" $1 "${name}-%d.png" | |
} | |
# this will split image into slices: | |
$ slice solid.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment