Re: [PHP] A kewl Script, for you someone to test, and show me theresults
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. -Rasmus 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 > > > > $imgname = "/path/to/a/jpeg/file"; > $im = ImageCreateFromJPEG($imgname); > $output = " "; > for($x=0;$x { > for($y=0;$y { >$color = ImageColorsForIndex(ImageColorAt($im, $x, $y)); >echo "echo dechex($color['red']); >echo dechex($color['green']); >echo dechex($color['blue']); >echo "\">\$"; > } > echo "\n"; > } > ?> > > > - James "ReDucTor" Mitchell > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] A kewl Script, for you someone to test, and show me theresults
Oh, by the way, I modified your script a bit and made it load an indexed PNG file instead. This is the modified script: http://www.php.net/~rasmus/reductor.phps And here is the result: http://www.php.net/~rasmus/reductor.php Not sure why you used a $ sign for the character. It sort of throws off the aspect ratio. Try a # instead: http://www.php.net/~rasmus/reductor.php?ch=%23 -Rasmus 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 > > > > $imgname = "/path/to/a/jpeg/file"; > $im = ImageCreateFromJPEG($imgname); > $output = " "; > for($x=0;$x { > for($y=0;$y { >$color = ImageColorsForIndex(ImageColorAt($im, $x, $y)); >echo "echo dechex($color['red']); >echo dechex($color['green']); >echo dechex($color['blue']); >echo "\">\$"; > } > echo "\n"; > } > ?> > > > - James "ReDucTor" Mitchell > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]