I thought i should post a version of the script  ( see attachment ); 

usage:  minimalpano.sh filename.jpg

Requires VIPS 

On Saturday, 10 September 2016 10:00:23 UTC+1, stuartmm wrote:
>
> Like stativ I use VIPs but only to generate image tiles. 
> http://libvips.blogspot.co.uk/2013/03/making-deepzoom-zoomify-and-google-maps.html
>
> I then have a script that creates a web page with correct parameters (new 
> directory name etc) using leaflet .  http://leafletjs.com
>
> It is very fast to display and zoom large images. 
>
>

-- 
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
--- 
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/hugin-ptx/090d30b3-d731-47a6-9307-18b7557618a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#!/bin/bash
# SM Sep 2016
# NB does no checking for files/executables etc
# Needs VIPS http://www.vips.ecs.soton.ac.uk/index.php?title=VIPS
# Usage minimalpano.sh filename.jpg
# Should probably use CRS.simple

if [ ! -n "$1" ]; then echo "Usage: `basename $0` file.jpg"; exit $E_BADARGS; fi

numDirectories=0

writeFile () {

cat > "$1".html <<'endmsg'
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>USETITLE</title>
    <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"; />
    <style type="text/css">
        html, body, #photo { width: 100%; height: 100%; padding: 0; margin: 0; }
    </style>
</head>

<body>
    <div id="photo"></div>
    <script src="https://unpkg.com/[email protected]/dist/leaflet.js";></script>
    <script type="text/javascript">
        var map = L.map('photo', { minZoom : 2 , maxZoom : USEMAXZOOM } ).setView(new L.LatLng(0,0), 0);

        var  mapTiles='./DIRECTORYNAME/{z}/{y}/{x}.jpg';

        L.tileLayer( mapTiles, {noWrap: true ,
                     errorTileUrl : "./DIRECTORYNAME/blank.png",
                     attribution: ' Test ' 
                     }).addTo(map);
    </script>
</body></html>
endmsg

}

generateTiles () {
vips dzsave $1.jpg[autocrop] $1-dir --layout google --centre --suffix .jpg --background 115,116,117 --overlap 1
# used for maxZoom
numDirectories=$( find $bname-dir -mindepth 1 -maxdepth 1 -type d | wc -l )
let "numDirectories -= 1"
}

updateFile () {
# edit in the created directory
sed -i.bak -e 's/USETITLE/'$1'/g' -e 's/DIRECTORYNAME/'$1'-dir/g' -e 's/USEMAXZOOM/'$numDirectories'/g' $1.html
}

# get a working name to use for other things
bname=$(basename "$1" .jpg )

writeFile $bname
generateTiles $bname
updateFile $bname

# open the file in browser
xdg-open $bname.html


Reply via email to