detect colors in picture with php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
potato
Forum Contributor
Posts: 192
Joined: Tue Mar 16, 2004 8:30 am
Location: my lovely trailer, next to the big tree

detect colors in picture with php

Post by potato »

Hi,

i'm working on a image-lybrary in php.
What i'm looking for is to detect the general color tints of an image.
So when theres much black in a picture, i get 000000 for example.
Is it possible to do that?

I've looked at google for it but cant find find any system that works like that. :(

hope anybody can help me...

grretings and a cold beer!

tom
User avatar
potato
Forum Contributor
Posts: 192
Joined: Tue Mar 16, 2004 8:30 am
Location: my lovely trailer, next to the big tree

Post by potato »

ok, i found this class. Looks perfect, gonna try it now...
http://www.phpclasses.org/browse/package/3370.html
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I think onion2k had some scripts that could do such stuff. They may be floating around here, but are likely on his site.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Bevibed.be wrote:ok, i found this class. Looks perfect, gonna try it now...
http://www.phpclasses.org/browse/package/3370.html

Code: Select all

imagecopyresampled($image_resized, $image_orig, 0, 0, 0, 0, $width, $height, $size[0], $size[1]); //WE NEED NEAREST NEIGHBOR RESIZING, BECAUSE IT DOESN'T ALTER THE COLORS
Err.. :? ... that doesn't fill me with confidence.

I wrote a histogram script once. It's on here somewhere. It'll turn up with a search I expect.
Post Reply