The imagecolorat() function doesn't work for truecolor images.  You will
need a an indexed image for this to work.  And worse, imagecolorat()
actually segfaults when run on a non-indexed image as far as I can tell.
Will commit a fix for that shortly.


On Thu, 27 Sep 2001, ReDucTor wrote:

> Hey,
>    I couldn't be bothered waiting for someone to show me a host that runs
> php with GD, so i am just going to post the code here, and hope that someone
> sees it, and checks it out, and shows the results
> If you can't find a jpg file to test this on, just grab the php jpg one,
> well i'll post the code now, so people can play with it, remember if you
> test it place show the results :D
> btw if you don't understand how to use it, you paste the code into a .php
> file, and change imgname to the path of an jpg image, if you want to use an
> png image, just change the im to ImageCreateFromPNG, ok, thats all...please
> show the results
> <html>
> <body bgcolor="#000000">
> <?php
>  $imgname = "/path/to/a/jpeg/file";
>     $im = ImageCreateFromJPEG($imgname);
>  $output = " ";
>  for($x=0;$x<imagesx($im);$x++)
>  {
>   for($y=0;$y<imagesy($im);$y++)
>   {
>    $color = ImageColorsForIndex(ImageColorAt($im, $x, $y));
>    echo "<font size=\"1\" color=\"#";
>    echo dechex($color['red']);
>    echo dechex($color['green']);
>    echo dechex($color['blue']);
>    echo "\">\$</font>";
>   }
>   echo "<br>\n";
>  }
> ?>
> </body></html>
>      - James "ReDucTor" Mitchell

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to