Skip to content

Instantly share code, notes, and snippets.

@camb416
Created February 19, 2016 17:38
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 camb416/c5f45520e2f066697f1b to your computer and use it in GitHub Desktop.
Save camb416/c5f45520e2f066697f1b to your computer and use it in GitHub Desktop.
One week series. Slicing images from top to bottom over time.
#!/bin/bash
# One week series. Slicing images from top to bottom over time.
# http://cameronbrowning.com/content/one-week-series/
# Originally adapted from earlier work at:
# http://cameronbrowning.com/content/creating-slit-scan-images-from-quicktime-movies-with-ffmpeg-on-mac-os-x/
# Step 1: loop through 10,078 images
for i in `seq -f "%05g" 1 10078`;
do
# subtract 1 from the counter for the y offset
# mycmd=$(printf "mogrify -crop 352x1+0+%d image-%04d.jpg\n" `expr "$i" - "1"` $i)
whichfile=$(printf "$i.jpg")
myvar=$(expr "$i" \* "240" / "10078")
# output the command that's about to be executed
# so you can see progress
mycmd="mogrify -crop 352x1+0+$myvar $whichfile"
echo $mycmd
# then execute it.
$mycmd
done
# after this execute this to generate the tall scan:
# montage *.jpg -tile 1x -mode concatenate tallscan.png
# then lets slice the tall scan into 7 chunks
# (by omitting the offset in the crop param, it auto slices)
# convert tallscan.png -crop 352x1440 tallslice.png
# now stick them together
# montage tallslice-*.png -tile x1 -mode concatenate tallslice_combined.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment