Google Blogoscoped has an interesting pointer to a star effect on a Google Earth satellite image. Apparently the consensus is that its the sun reflecting off a solar panel, but it’s still nice.
I have a directory full of thumbnails of the rental tour I went on the other day while looking for a new apartment, and I want to put them online. Instead of putting each photo online, which I thought might be boring, I wanted to build a stack on images on a background.
I’m not really describing the effect well, so here’s the output so you know what I mean:
This was remarkably easy to create with a simple script that uses ImageMagick. Here’s the code:
# Setup the random number stuff
# Create a white image to start with
convert -size $HIBOUND"x"$HIBOUND xc:lightgray output.png
for img in img*jpg
echo "Processing $img"
# Rotate the image if needed
if [ `exif $img | grep Orientation | grep bottom | wc -l | tr -d " "` -gt 0 ]
convert -rotate -90 $img img.png
convert $img img.png
imgwidth=`identify -ping img.png | cut -f 3 -d " " | cut -f 1 -d "x"`
imgheight=`identify -ping img.png | cut -f 3 -d " " | cut -f 2 -d "x"`
# For more information on bounded numbers with bash, see
x=$(( $LOBOUND + (($HIBOUND - $imgwidth) * $RANDOM) / ($RANDMAX + 1) ))
y=$(( $LOBOUND + (($HIBOUND - $imgheight) * $RANDOM) / ($RANDMAX + 1) ))
# Put the image on top of the accumulative image
mv output.png input.png
convert -draw "image atop $x,$y $imgwidth,$imgheight img.png" input.png output.png
First the script creates an empty image to place the thumbnails over. Then for each image it checks if the image needs to be rotated, and what size it is. I use the size of the image to determine what the maximum value for the two random values I need are (the random values from the coordinates of the top left of the thumbnail image, and I don’t want any images falling off the edge of the new image). The the image is placed on top of the accumulating image.
It’s just a little ImageMagick hack I thought I would share.