Hi everyone, i want to process image byte in PHP. Does anyone know how to convert image to array of bytes in PHP? Thanks. Ivan
I would suggest to use imagecolorat: $img_ar = array(); $im = imagecreatefromjpeg('/path/to/image.jpg'); if (! $im) die("cant load image"); for ($x=0; $x<imagesx($im); $x++) { for ($y=0; $y<imagesy($im); $y++) { $img_ar[$x][$y] = imagecolorat($im, $x, $y); } } // process $img_ar Code (markup): But probably it is better to use imagecolorat directly.
thanks livedatesearch, i will try it. But it realize thats a GD library. i wonder if imagick can do the same. or do you have any idea?