here is my lame attempt:

#!/usr/bin/perl # # 100 simultaneous supernovae collapse into a supermassive blackhole! # This makes a pretty picture by incrementing the sigma values on the # sample data resulting in an animated GIF. Please feel free to hack # it up and post your version! use strict; use warnings; use Imager::Heatmap; my $filename = 'heatmapa.gif'; my @insert ; my @images = (); $| = 1; print "Generating GIF frame "; my $text = Imager->new(xsize=>300,ysize=>30); $text->box( color => Imager::Color->new(255, 255, 255), filled=>1 ); my $black = Imager::Color->new("#000000"); my $font = Imager::Font->new( file => '/usr/share/fonts/open-sans/OpenSans-Semibold.ttf', color => $black, size => 25); my $japh = "Just another Perl hacker,"; $text->string(font=>$font, text=>$japh, color=>$black, x=>1, y=>20); $text->write(file=>'fuck.png', type=>'png') or die "Cannot write: ",$text->errstr; for my $x (0..299){ for my $y (0..24){ my $pix = ($text->getpixel(x=>$x, y=>$y, type=>'8bit')->rgba())[0] +; next if( $pix == 0 ); push @insert, [ $x, $y, $pix ] ; } } for my $x ('1'..'10') { my $hmap = Imager::Heatmap->new( xsize => 300, ysize => 30, xsigma => $x, ysigma => $x, ); $hmap->insert_datas(@insert); push @images, $hmap->draw; print "$x " } print "done!\n"; Imager->write_multi({ file => $filename, transp => 'none', gif_loop => 0, }, @images); print "Saved $filename\n";

bw, bliako


In reply to Re: Animated Heatmap by bliako
in thread Animated Heatmap by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.