the color of a pixel

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
fm31
Posts: 22
Joined: Tue Apr 23, 2013 2:08 pm

the color of a pixel

Post by fm31 » Wed Oct 23, 2013 10:04 am

hello

I need to know the RGB value of a pixel in an image. for example, I want to know the color of the pixel at a specific point (ex 100,100) without using the mousecolor property. my probleme is to put in a container all the colors RGB code existing in an image in a stack.

do you have a solution for that ?

thanks all

François

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4002
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: the color of a pixel

Post by bn » Wed Oct 23, 2013 12:43 pm

Hi Françcois,

do you just need all the unique RGB values of a given image or do you need the RGB value for each pixel?

Kind regards
Bernd

fm31
Posts: 22
Joined: Tue Apr 23, 2013 2:08 pm

Re: the color of a pixel

Post by fm31 » Wed Oct 23, 2013 3:42 pm

hello

thanks for your reply

in fact, the both are availables !!!

"need all the unique RGB values of a given image

and need the RGB value for each pixel
"

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4002
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: the color of a pixel

Post by bn » Wed Oct 23, 2013 8:24 pm

Hi François,

here is a little stack that gives you
1) all the unique RGB values of an image (did not implement frequency but is easy to do) are put as list into a field.

2) Then there is a button that ask you for a point in the image (e.g. 53,100) and returns the RGB value for it. You could expand that to a list of all points but that list could get long.

And if you move over the image it displays the column and the row relative to the image and puts the mouseColor into a field (sort of a control for 2)

Some comments in the code, you might want to read up in the dictionary about imageData.
Feel free to ask if something is not clear.

Kind regards
Bernd
Attachments
rgbValuesOfImage.livecode.zip
(25.08 KiB) Downloaded 363 times

fm31
Posts: 22
Joined: Tue Apr 23, 2013 2:08 pm

Re: the color of a pixel

Post by fm31 » Thu Oct 24, 2013 6:56 am

he

tthanks for your stack. it give me a good example of the fonction imagedata I have found yesterday afternoon in the dictionnary. now, J understand how it works
thanks for your help

François

Post Reply

Return to “Multimedia”