|
Posted by firewoodtim on 01/10/06 00:35
On Mon, 09 Jan 2006 21:00:18 GMT, Oli Filth <catch@olifilth.co.uk>
wrote:
>firewoodtim said the following on 09/01/2006 19:08:
>> On Mon, 09 Jan 2006 01:39:26 GMT, Oli Filth <catch@olifilth.co.uk>
>> wrote:
>>
>>>firewoodtim said the following on 08/01/2006 18:53:
>>>
>>>>I want to analyze a GIF file and retrieve the histogram data on the
>>>>image (pixel quantity and color symbol for each color in the file.)
>>>>Does anyone know how to use PHP to do this?
>>>
>>>Load the image with imagecreatefromgif(). Then loop through each pixel
>>>of the image, call imagecolorat() to obtain the palette index for that
>>>pixel, and increment a tally for each palette index.
>>>
>>>These functions are described in the PHP manual.
>>
>> I did what you suggested, and it worked as predicted, but that still
>> leaves me with just the palette index for each color. i still need to
>> correlate that with the palette itself, in order to get the actual
>> color value. Can you advise me on how to get a GIF's palatte?
>
>Dude, did you take any time *at all* to have a look at the PHP manual
>for the GD functions? If you'd looked at the manual page for
>imagecolorat(), for instance, you would've seen some "See also" links,
>some of which you might have found useful...
Oli,
Thanks for the info. That does help me a lot. It looks like
imagecolorsforindex() provides the missing link.
Navigation:
[Reply to this message]
|