[magick-users] Generating a shadow for google maps
paul at magick.sbrk.co.uk
paul at magick.sbrk.co.uk
Wed Nov 30 02:55:51 PST 2005
I'm trying to come up with an automated way of generating shadows for
google maps icons. According to the google maps api documentation:
http://www.google.com/apis/maps/documentation/#Icons_and_Markers
"Every icon has (at least) a foreground image and a shadow image. The
shadow should be created at a 45 degree angle from the foreground image,
and the bottom left corner of the shadow image should align with the
bottom-left corner of the icon foreground image. The shadow should be
a 24-bit PNG images with alpha transparency so that the edges of the
shadow look correct on top of the map."
Google's typical marker and shadow can be obtained here:
http://www.google.co.uk/intl/en_uk/mapfiles/marker.png
http://www.google.co.uk/intl/en_uk/mapfiles/shadow50.png
An example of how to do this using PSP and POV-RAY is here:
http://www.econym.demon.co.uk/googlemaps/custom.htm
and there's also a short tutorial here:
http://googlemapsapi.blogspot.com/2005/11/happy-turkey-day.html
My current attempt looks something like this:
convert -background none -shear 30x0 -scale x50% -shadow 50 i.png o.png
followed by an identify and splice to make the
shadow the same height as the original.
The result can be seen here: http://www.sbrk.co.uk/test/letters2.html
It doesn't look too bad until you get to "q" and see that the base of
the shadow doesn't line up with the icon. That's due to me doing a trim
after I do the shear. I tried doing a trim before the shear, but every
time this happens:
$ convert -size 120x120 xc:transparent -font Bookman-DemiItalic \
-pointsize 50 -fill darkblue -stroke cyan -draw 'text 30,90 q' q.png
$ convert -background none -shear 30x0 -scale x50% -shadow 50 q2.png q2.png
convert: geometry does not contain image `q2.png'.
but
$ convert -background none -shear 30x0 -scale x50% -shadow 50 -trim q.png q3.png
works fine.
Can anyone give me a clue how to produce the shadow on a "q" and keep the
base of the q lines up? As there a better way of doing it than the above?
Thanks,
Paul
More information about the Magick-users
mailing list