|
Posted by firewoodtim on 01/09/06 21: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?
I need to wind up with an array, with the configuration:
key => value
num_of_pixels => color_code (ie #rrggbb)
Navigation:
[Reply to this message]
|