Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- determine if image is grayscale
September 9, 2004, 10:24 pm
rate this thread
i'm a bit new to PHP - i've been messing around with the GD2 image functions
and was wondering:
i see a lot of information about converting a color image to grayscale but i
can't figure out how to determine whether an image (GIF or JPG) is grayscale
in the first place.
is there a way to do this in PHP?
thanks for any advice!
Re: determine if image is grayscale
If it's a paletted image, imagecolorsforindex(), or for a true colour image
loop through the pixels and usage imagecolorat().
All the colours should have their red, green and blue components equal, or
near equal, if it's a greyscale image.
<http://www.andyhsoftware.co.uk/space Space: disk usage analysis tool
- Pjotr Wedersteers
September 11, 2004, 2:28 pm