in reply to Re^2: How to Parse Network Data Graph
in thread How to Parse Network Data Graph

Thats a very tough problem to solve. Just brainstorming about how to solve it reliably, I think the hardest part would be to get the axis tick mark values. How would you know, or get a program to detect what the graph's axis gradations are? Just for the sake of argument, if they were constant, and you could hard-code those into the program, you might be able to use one of the graphics modules, like Imager or ImageMagick, to do a pixel-by-pixel deconstruction of the image. Since most graphs have a constant background color, and a single graph color, you probably could analyze that data for peaks and lows. I'm not suggesting the following code is a solution, but it shows how to do a pixel-by-pixel deconstruction.
#!/usr/bin/perl use strict; use warnings; use Imager; # assumes a rgba image ( with alpha ) # otherwise use rgb instead of rgba my $image_source = shift @ARGV; my $image = Imager->new; $image->read( file => $image_source ) or die "Cannot load $image: ", $image->errstr; my $width = $image->getwidth(); my $height = $image->getheight(); print "Image dimensions: height = $height, width = $width\n"; # only grab some pixels on line 10 # for the whole image iterate over $width and $height my $x = 10; foreach my $y ( 10 .. 15 ) { my $color = $image->getpixel( x => $x, y => $y ); my ( $r, $g, $b, $a ) = $color->rgba(); print " shade = $r, $g, $b\n"; }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh