|
Posted by firewoodtim on 01/09/06 21:13
On Mon, 09 Jan 2006 19:08:47 GMT, firewoodtim <tim@ironwork.com>
wrote:
>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?
>
>I need to wind up with an array, with the configuration:
> key => value
>num_of_pixels => color_code (ie #rrggbb)
correction:
The array would actually be structured:
palette_index => array(#_pixels, #rrggbb);
Navigation:
[Reply to this message]
|