|
Posted by Norman Peelman on 08/31/07 03:01
William Gill wrote:
> I have found a couple of sites that allow a visitor to upload an image
> and the site returns either the "average color", or a palette of colors.
> Several of them use PHP to accomplish this. I have requested the source
> code, but have not gotten a response (even though one site states
> "source code available on request"). It is obvious that they read the
> colors of each pixel and them manipulate that data. I would like to be
> able to do something similar.
>
> I'm not very familiar with the PHP image functions, but have been able
> to figure out how to read pixel color on indexed color images, but not
> on jpegs. The best I can do now is convert a jpeg to a 256 indexed
> color image, and then read pixel color. Unfortunately too much of the
> original data gets lost.
>
> Does anyone know how to determine the color of jpeg pixels, or can you
> point me to a good tutorial on PHP image functions.
>
> For what it's worth, one of the things I want to do is determine the
> distribution of each color (i.e. 345 pixels of rgb1, 2436 pixels of
> rgb2, etc.), and possibly manipulate the image by removing and/or
> replacing any given color.
>
>
>
>
>
>
You really don't 'need' PHP for this... take a look at imagemagick at
http://www.imagemagick.org
and
http://www.imagemagick.org/Usage/compare/#metrics
Norm
[Back to original message]
|