Created
June 8, 2018 14:55
-
-
Save robertocarroll/9c61cf6000db79c65d73e4122b1b7d76 to your computer and use it in GitHub Desktop.
Slice images and stitch
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
tmpdir=tmp | |
if [ -d "$tmpdir" ]; then | |
rm -rf $tmpdir | |
fi | |
mkdir $tmpdir | |
height=2592 | |
width=10 | |
n=0 | |
for f in *.jpg | |
do | |
offset=$(($n*$width)) | |
c="$(printf "%05d" $n)" | |
echo "Creating slice $tmpdir/$c.png" | |
convert -crop ${width}x${height}+${offset}+0 $f $tmpdir/$c.png | |
n=$(($n+1)) | |
done | |
count="$(ls -1 $tmpdir | wc -l)" | |
echo "Joining $count slices into out.png" | |
montage $tmpdir/*.png -mode concatenate -tile ${count}x out.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment