Image::BioChrome

Image::Biochrome is a Perl module written Simon Matthews which manipulates the colour table in GIF files in interesting ways. The images produced here are all generated using the BioChrome plugin for the Template Toolkit. A few lines of simple code generate the following images on-the-fly with BioChrome colouring them according to parameters provided in the template.

Coloured Lozenges

Top Close Open

Here's another example where a single image is coloured in 36 different ways. Go on, count them.

Generating Template Source

Top Close Open

This is the template that generates the above table (or one very much like it - we've simplified this example a little for the sake of clarity).

[% USE bc = BioChrome("$imgdir/lozenge_bio_small.gif");
   palette = ['00', '33', '66', '99', 'CC', 'FF']
%]

<table border="0">
[% FOREACH row IN palette %]
<tr>
  [% FOREACH col IN palette; 
      hexcol = "${row}00${col}";
      bc.alphas("FFFFFF_${hexcol}_000000");
      bc.write_file("$imgdir/lozenge_chrome_${hexcol}.gif")
  %]
  <td>
   <img src="[% imgurl %]/lozenge_chrome_[% hexcol %].gif" 
      width="113" height="35" />
  </td>
  [% END %]
</tr>
[% END %]
</table>