Skip to content

Instantly share code, notes, and snippets.

@bdelbosc
Created November 13, 2015 10:17
Show Gist options
  • Save bdelbosc/07ca8aa9191cbca3f84e to your computer and use it in GitHub Desktop.
Save bdelbosc/07ca8aa9191cbca3f84e to your computer and use it in GitHub Desktop.
Script to generate quickly tiff images, requires libtiff-tools
#!/bin/bash
# number of images to generate
MAX=6607360
# directory that contains some tiff images used as template
SAMPLE=/tmp/sample
# directory where new tiff are generated
OUTDIR=/tmp/gentif
#OUTDIR=/opt/nuxeo/repo1/data
COUNT=0
COUNTER=$MAX
mkdir -p $OUTDIR
until [ $COUNTER -lt 0 ]; do
for i in `ls $SAMPLE/*.tif`; do
cp $i $OUTDIR/
f=$OUTDIR/$(basename $i)
tiffset -s 305 $HOSTNAME-$COUNT $f
o=$(md5sum $f| cut -d' ' -f1)
d=$OUTDIR/$(echo $o | sed "s,\(..\)\(..\).*$,\1\/\2,g")
mkdir -p $d
mv $f $d/$o
let COUNT+=1
let COUNTER-=1
done
echo -e ".\c"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment