use GD::Simple; my $png = GD::Image->newFromPng('test.png'); my @sw; my ($width, $height) = $png->getBounds; for my $x ( 0 .. $width-1 ) { for my $y ( 0 .. $height-1 ) { $sw[$y].=getPixel($x,$y); } } sub getPixel { my $p; my ($index) = $png->getPixel($_[0],$_[1]); my ($r,$g,$b) = $png->rgb($index); if ($b>128 || $r>128) {$p=0;} else {$p=1;} return $p; } #### use GD::Simple; my $png = GD::Image->newFromPng('test.png'); my @sw; my $pdata=''; my ($bx, $by) = $png->getBounds; my @col; # foreground colors for (0..$png->colorsTotal) { my ($r,$g,$b) = $png->rgb($_); push (@col,$_) unless ($b>128 || $r>128); } $pdata |= ~$png->wbmp($_) foreach (@col); our $zlen=int(($bx+7)/8); # number of Bytes per line my $pos=6; my $y=0; # position after Header of WBMP while ($pos