]> git.sesse.net Git - gifmaker/blob - pairwise-to-pgm.pl
Add a Perl script to convert the output of find-pairwise-distance to a PGM file for...
[gifmaker] / pairwise-to-pgm.pl
1 #! /usr/bin/perl
2 use strict;
3 use warnings;
4 use POSIX;
5
6 my $width = 599;
7 my $height = 599;
8 my $max = 7263081;
9
10 print "P5\n$width $height\n255\n";
11 while (<>) {
12         /(\d+) (\d+) (\d+)/ or die;
13         my ($i, $j, $z) = ($1, $2, $3);
14         $z = log($z + 1.0) / log($max + 1.0);
15         $z = pow($z, 20);
16         print chr(int(255.0 * $z));
17 }