#!/bin/sh## Copyright (c) 2015-2016 Marcus Rohrmoser http://mro.name/~me. All rights reserved.## This program is free software: you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation, either version 3 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program. If not, see <http: //www.gnu.org/licenses></http:>.#cd"$(dirname "$0")" ; mkdir build ; cd build
src="../../Spray-2.svg"inkscape=/Applications/Inkscape.app/Contents/Resources/bin/inkscape
${inkscape}--help>/dev/null 2>&1||{echo"Inkscape is not installed."&&exit1; }
pngquant --help>/dev/null 2>&1||{echo"pngquant is not installed."&&exit1; }
optipng -help>/dev/null 2>&1||{echo"optipng is not installed."&&exit1; }pngquant="pngquant --skip-if-larger --speed 1"OPTS="--export-area-page --export-width=1024 --export-height=1024 --export-background=white --without-gui"dst="iTunesArtwork.png""${inkscape}"--export-png="$(pwd)/${dst}"$OPTS--file="$(pwd)/${src}"${pngquant}"$(pwd)/${dst}"&dst=iTunesArtwork.svg
cp"${src}""${dst}"# http://stackoverflow.com/a/10492912${inkscape}"$(pwd)/${dst}" \
--verb=FileVacuum --verb=FileSave \
--verb=FileClose --verb=FileQuit
${inkscape}$OPTS--vacuum-defs--export-plain-svg="$(pwd)/${dst}"--file="$(pwd)/${dst}"for siz in29406076dofor scale in123dodst="AppIcon-${siz}x${siz}@${scale}.png"
sips --resampleHeightWidthMax"$(($siz * $scale))" iTunesArtwork.png --out"${dst}"${pngquant}${dst}&donedonesiz=167scale=2dst="AppIcon-83x83@${scale}.png"
sips --resampleHeightWidthMax"${siz}" iTunesArtwork.png --out"${dst}"${pngquant}${dst}&waitfor i in*-fs8.png
domv"${i}""$(basename "${i}" -fs8.png).png"donefor i in*.png
do
optipng -o7"$i"&donewait

Sadly it can’t display old-school Tile Map Service maps as e.g. produced by gdal2tiles.py1) because the y-values are flipped upside down. The OSM Wiki says about this fact: „This is really just an unfortunate historical misalignment.“

But with the drop-in MKTileOverlay replacement below, you can use flipped geometries and add {-y} in the URL template to indicate such: