The Snapshot function – saving mosaics as images

March 15th, 2006 in The Making of TheBroth · By Markus Weichselbaum

One of the first cool features that we were eager to implement was a snapshot function, so we could preserve the transient masterpieces that were being created in front of our eyes.

The GD library for PHP makes this task easy. We’re creating a full-size image by simply “painting” the position of the tiles onto a blank canvas, and saving the image to disk. The thumbnail image is created using GD’s resize function, and also saved to disk.

Haven’t seen the snapshots yet? Go visit TheBroth’s art gallery!

Why PNG format?

We decided on using the PNG format (PNG-24, to be specific) for the snapshots, as this produced images with the smallest file size, yet yields much better quality than the JPEG format. This isn’t surprising, as snapshots of TheBroth mosaics aren’t really photographic in nature. The snapshots are more like “graphics”, with flat colors and plenty of blank, fully white background, and images of this type can be saved economically in PNG format.

art

Unfortunately, the thumbnails don’t look good in either format, but here JPEG files were smaller, so that’s what we use for the thumbnails.

Why not GIF? Because just like PNG-8, it allows for only 256 different colors, unlike JPEG and PNG-24 which are true color (eg. full 24 bit color) formats.

Share this:
  • del.icio.us
  • StumbleUpon
  • Furl
  • Netscape
  • Reddit
  • Technorati
  • YahooMyWeb

2 Responses to “The Snapshot function – saving mosaics as images”

freaky friday25 Jul 06

The snapshot function is by far the best feature of TheBroth. My favourite past time of late has been browsing through the galleries rating and commenting on the snapshots.

GO GO2 Oct 06

I wonder how it really remembers position of each tile…….is it stored separately? and some how its combines the png image with its tileinfo in snappy

Leave a comment