in reply to Generating image (map)
This is very easy using GD. The data is random and the plot greyscale, but this does pretty much exactly what you've described:
#! perl -slw use strict; use GD; sub rgb2n { unpack 'N', pack 'CCCC', 0, @_ } my @heights = map [ map int rand 256, 1 .. 500 ], 1 .. 500; my $img = GD::Image->new( 500, 500, 1 ); for my $y ( 0 .. $#heights ) { for my $x ( 0 .. $#{ $heights[ $y ] } ) { $img->setPixel( $x, $y, rgb2n( ( $heights[ $x][ $y ] ) x 3 ) ) +; } } binmode STDOUT; print $img->png;
Run it as theScript > a.png and then load the png into your favorite image viewer.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Generating image (map)
by bobo (Novice) on Mar 19, 2010 at 22:13 UTC | |
by BrowserUk (Patriarch) on Mar 19, 2010 at 22:21 UTC | |
by bobo (Novice) on Mar 19, 2010 at 22:27 UTC | |
by BrowserUk (Patriarch) on Mar 19, 2010 at 22:54 UTC | |
|
Re^2: Generating image (map)
by bobo (Novice) on Mar 19, 2010 at 23:54 UTC | |
by BrowserUk (Patriarch) on Mar 20, 2010 at 00:08 UTC | |
by bobo (Novice) on Mar 20, 2010 at 01:02 UTC | |
by BrowserUk (Patriarch) on Mar 20, 2010 at 06:48 UTC | |
by bobo (Novice) on Mar 20, 2010 at 00:23 UTC |