Skip to content

Instantly share code, notes, and snippets.

@kmlawson
Last active October 13, 2019 15:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmlawson/7ea611531554eeba1526e98c89e17f2b to your computer and use it in GitHub Desktop.
Save kmlawson/7ea611531554eeba1526e98c89e17f2b to your computer and use it in GitHub Desktop.
Creates a simple command line interface to openseadragon, making use of dezoom.sh
# This is a wrapper for: https://github.com/lovasoa/dezoom.sh
# Running that command can be tedious if you have a regular URL pattern from openSeaDragon,
# such as the NLA format: https://nla.gov.au/[some image id]/dzi?tile=14/44_38.jpg
# Running this will prompt you for the url pointing to the highest X_Y tile and will
# then construct the appropriate dezoom.sh command using -X and -Y parameters
# it assumes you have wget and ImageMagick installed, and that the dezoom.sh file
# is in the same directory.
echo Paste in the highest tile on zoom level 14:
read fullurl
myx=`echo $fullurl | sed 's/.*14\/\([0-9]\{1,2\}\).*/\1/'`
myy=`echo $fullurl | sed 's/.*14\/[0-9]\{1,2\}_\([0-9]\{1,2\}\).*/\1/'`
newurl=`echo $fullurl | sed 's/\(.*14\/\)[0-9]\{1,2\}_[0-9]\{1,2\}.*/\1%X_%Y.jpg/'`
echo Updated URL:
echo $newurl
echo Highest X tile:
echo $myx
echo Highest Y tile:
echo $myy
echo Running dezoomify...
`./dezoom.sh -X $myx -Y $myy "$newurl"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment