Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Generate bunch of favicons, the original should preferrably be 500x500 png image
- if [ $# -ne 1 ]; then
- echo USAGE: $0 favicon-original.png
- exit 1
- fi
- ORIGINAL=$1
- # IE is still braindead so still use favicon.ico
- convert -resize x16 -gravity center -crop 16x16+0+0 -flatten -colors 256 ${ORIGINAL} output-16x16.ico
- convert -resize x32 -gravity center -crop 32x32+0+0 -flatten -colors 256 ${ORIGINAL} output-32x32.ico
- convert output-16x16.ico output-32x32.ico favicon.ico
- rm output-16x16.ico output-32x32.ico
- # Then, HTML needs to specify size="XxY" as largest size due to browser bugs
- echo '<link rel="shortcut icon" href="/favicon.ico" sizes="32x32" />'
- # Apple favicons
- for SIZE in 180 152 144 120 114 76 72 60 57
- do
- convert -resize x${SIZE} ${ORIGINAL} apple-touch-icon-${SIZE}x${SIZE}.png
- echo "<link rel=\"apple-touch-icon\" sizes=\"${SIZE}x${SIZE}\" href=\"apple-touch-icon-${SIZE}x${SIZE}.png\" />"
- done
- # Normal favicons
- for SIZE in 192 160 96 32 16
- do
- convert -resize x${SIZE} ${ORIGINAL} favicon-${SIZE}x${SIZE}.png
- echo "<link rel=\"icon\" type=\"image/png\" sizes=\"${SIZE}x${SIZE}\" href=\"favicon-${SIZE}x${SIZE}.png\" />"
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement