Capturing the RBG of a sequence of pixels

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Maxiogee
Posts: 38
Joined: Thu May 05, 2011 5:45 pm

Capturing the RBG of a sequence of pixels

Post by Maxiogee » Sun Jun 19, 2016 12:39 pm

I have a photograph which I wish to stylise.
I intend to replace, both vertically and horizontally, ever second pixel's color value with that o the preceding one.
Thus, the color value of the pixel at 1,1 will also be given to the pixels at 1,2 and 2,1 and 2,2>

I have expected that the script for capturing the RGB of a given pixel might be

repeat with a = 1 to 500
if a mod 2 = 1 then
repeat with b = 1 to 500
if b mod 2 = 1 then
put a & "," & b into HV
put the backgroundColor of HV into NewColor
go to card 2
set the pencolor to NewColor
choose pencil tool

and so forth.

But the "backgroundcolor" gives me an error.

Any advice?

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Capturing the RBG of a sequence of pixels

Post by Klaus » Sun Jun 19, 2016 3:40 pm

Hi Max,

dealing with image pixels is a bit more tricky than you may think, this may get you started to work with images and its RGB values:
http://lessons.livecode.com/m/4071/c/16770

BTW:

Code: Select all

...
put a & "," & b into HV
put the backgroundColor of HV into NewColor
...
Variables do not have any color properties (nor any other) 8)


Best

Klaus

Post Reply