Skip to content

Instantly share code, notes, and snippets.

@beryllium
beryllium / tiles.md
Created May 3, 2019 16:55 — forked from veltman/tiles.md
Making a big image zoomable

Making a big image zoomable

When you have a giant image and you want to make it easy to pan and zoom without downloading the whole 50MB image into someone's browser, a nice workaround is to cut that image into tiles at different zoom levels and view it as it were a map. An example where I've used this technique is The "Snowpiercer" Scenario.

One way to cut your big image into the requisite tiles is with gdal2tiles.py.

Alternatively, this Node script will do the cutting after you install node-canvas and mkdirp:

const fs = require("fs"),
@beryllium
beryllium / quick-slugify.sh
Last active December 7, 2016 07:54 — forked from oneohthree/quick-slugify.sh
Quick bash slugify
# Updated to work on OS X (convert both "-E" flags to "-r" to run on real server OSes)
echo "$STRING" | iconv -t ascii//TRANSLIT | sed -E s/[^a-zA-Z0-9]+/-/g | sed -E s/^-+\|-+$//g | tr A-Z a-z