Thumbnail Support
From Open Clip Art Library Wiki
How should we support thumbnails in OCAL?
The problem is, AFAIK, we make the thumbnails using Inkscape, probably with something like:
inkscape -f "file.svg" -e "file.png" -w 128.
Unfortunately, in order to keep the correct aspect ratio, we can't specify both width and height - see
as an example.
In order to make the image fit on 128x128, we can run a script like the one below, which will process all PNGs from a directory.
for i in*.png; do convert -size 128x128 "$i" -resize 128x128 "$i ; done
I guess we can also use a second script, this time using combine to suprapose thumbnails over a 128x128 transparent PNG, but I have to dig for the exact parameters.
note: both convert and combine are part of ImageMagik (so should be available on a default Linux install)
#!/bin/sh
inkscape $1 --export-width 128 --export-png first.png >/dev/null
if [ `identify -format "%h" first.png` -gt 128 ]; then
inkscape $1 --export-height 128 --export-png first.png >/dev/null;
fi
w=`identify -format "%w" first.png`
h=`identify -format "%h" first.png`
xo=`echo 128 $w - 2 / p|dc`
yo=`echo 128 $h - 2 / p|dc`
composite -geometry +$xo+$yo first.png blank.png $1.thumb.png

