use GD; # create a new image $im = new GD::Image(1024,768); $bildin= "img/CH_IR039/05100100.039"; $bildout= "img/CH_IR039/05100100.png"; $bildin2= "img/CH_IR108/05100100.108"; $bildout2= "img/CH_IR108/05100100.png"; $befehl = "convert ".$bildin." ".$bildout; system($befehl); $befehl2 = "convert ".$bildin2." ".$bildout2; system($befehl2); $myImage = GD::Image->newFromPng($bildout); $myImage2 = GD::Image->newFromPng($bildout2); $k=0; for ($x=0 ; $x<=1023; $x++) { for ($y=0 ; $y<=767; $y++) { $index = $myImage->getPixel($x,$y); $index2 = $myImage2->getPixel($x,$y); ($Image1,$dummy1,$dummy1) = $myImage->rgb($index); #Achtung evt. $red[] ($Image2,$dummy1,$dummy1) = $myImage2->rgb($index2); $color = $Image1-$Image2; $im->setPixel($x,$y,$color); $k++; } } open(PICTURE, ">picture.png") or die("Cannot open file for writing"); binmode PICTURE; print PICTURE $im->png; close PICTURE;