<?php
//On veut ouvrir une image au format PNG
$fichier = "image.png";
//On charge l'image
$orig = imagecreatefrompng($fichier);
//On récupere les informations de l'image
$infos = getimagesize($orig);
$largeur = $infos[0];
$hauteur = $infos[1];
//On parcourt les pixels de gauche à droite, de haut en bas
for($y=0;$y<$hauteur;$y++)
{
for($x=0;$x<$largeur;$x++)
{
$rgb = imagecolorat($orig, $x, $y); //Pour chaque pixel, on récupère un triplet d'octets
$r = ($rgb >> 16) & 0xff; //Composante RED - ROUGE
$g = ($rgb >> 8) & 0xff;//Composante GREEN - VERT
$b = $rgb & 0xff;//Composante BLUE - BLUE
}
}
}
?>