I never used any image stuff with php so yout enquiry made me interested so i modified your script abit.
CODE
<?
$image_name = "test.png";
$data_file = fopen("output.txt", "w");
$im = ImageCreateFromPng($image_name);
$image_info = getimagesize($image_name);
$width = $image_info[0];
$height = $image_info[1];
$data = "Image Name: ".$image_name."nImage Width: ".$width."nImage Height: ".$height."nn";
fwrite($data_file, $data);
$count = 0;
for ($j=1;$j<=$width;$j++)
{
for ($k=1;$k<=$height;$k++)
{
$rgb = ImageColorAt($im, $j, $k);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
$data = "Width: ".$j." Height: ".$k." Red: ".$r." Green: ".$g." Blue: ".$b."n";
fwrite($data_file, $data);
$count++;
}
}
$data = "nFile finishednPixels Processed: ".$count;
fwrite($data_file, $data);
fclose($data_file);
?>
you just create a folder say on your desktop
create a text file call it whatever.php add you png image to the same directory or modify the $image_name variable to include the path to the image.
then just open the console cd to the directory and: php whatever.php
thats it.
did a 75.6K png in around 2-3 seconds on my 1800xp, processing 82875 pixels, the output.txt file was 400K
just as a note the version i am using is the default for mandrake 9.0 php4.2.3.
ImageColorAt does not support alpha channel, if you have an alpha channel it will work it will just give you the RGB only.