|
Posted by Andy Hassall on 11/04/05 22:06
On 4 Nov 2005 11:42:47 -0800, lkrubner@geocities.com wrote:
>That's awesome. I tried the following and I got a long list of numbers
>8 digits long.
>
>$myFileAsString =
>file_get_contents("http://www.mycompany.com/product_images/composite_standard_sm/318_1_SM_100.jpg");
>
>$image = imagecreatefromstring($myFileAsString);
>
>$width = imagesx($image);
>$height = imagesy($image);
>
>echo "<p>the height is $height and the width is $width </p>";
>for ($i=0; $i < $width; $i++) {
> for ($r=0; $r < $height; $r++) {
> $rgb = imagecolorat($image, $i, $r);
> echo $rgb;
> echo "<br>";
> }
>}
>
>which gave me something like this:
>
>16645629
>16711422
[snip]
>but a lot more of that.
Good, that's what you asked for. All you need to do now is read the
imagecolorat manual page a bit more closely and convert it into the hex
representation you wanted (sprintf and %x is useful here), and you're done.
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Navigation:
[Reply to this message]
|