Rev Graphics Gurus

Dar Scott dsc at swcp.com
Tue Oct 17 13:31:04 EDT 2006


On Oct 17, 2006, at 10:34 AM, John Vokey wrote:

> I need to manipulate the contents of images in Rev in two ways:

The general method for manipulating the contents of images is through  
the imageData property (and alphaData property) of the image  
control.  There are four bytes per pixel in imageData.  One is unused  
(0) and the rest are RGB.  Details are in the dictionary.

> 1) I need to average, pixel by pixel, two images (of the same size)  
> before display of that average.  So, the question is: how do I  
> access the individual pixels of the two images?  Do I load them as  
> binary, and then locate the pixels (somehow) within the binary  
> objects?  Load them as images, and then (somehow) access Rev's  
> internal representation?

In this particular case, there might be a shortcut.  Try something  
like this.  To average the display of several images, put them into a  
group and set the ink property of the group and each of them to  
blendSrcOver.  Starting from the back, set the opacity to 1, 1/2,  
1/3, 1/4 etc.  That is, set the blendLevel property to 0%, 50%, 67%  
75% and so on.  This will display the average image.  If you need a  
file or composite image object, set the group margins to zero and use  
export snapshot from the group.  (For two, leave the blendLevel at 0  
for the back one and set the one in front to 50.)

> 2) I need the end user to be able manipulate within Rev under user  
> control the RGB of CMYK settings of an image (e.g., increase B,  
> while decreasing R, and so on) much like the RGB and CMYK sliders  
> in the OS X Colors palette, and then apply (on the fly) those new  
> settings to a displayed image.  Any suggestions even to get me  
> started will be helpful.

Again, there might be a shortcut for RGB.  Tinker with this.  Make a  
rectangle the same size as the image.  Group the rectangle and the  
image with the rectangle over the image.  Set the ink of the image  
and the rectangle to blendSrcOver.  Set the ink of the rectangle to  
blendMultiply.  Set the rectangle's border to 0, maybe.  Make it  
opaque.  Set the color so the RGB values are 255 times the Red, Green  
and Blue multipliers.  (I don't know how to do this for multipliers  
greater than 1, maybe using dodge and shifting layer.)  As above, you  
can get the composed image by export snapshot.  Funny, you should  
mention this.  I'm making a mock up of this this afternoon.

If you can convert CMYK multipliers into RGB multipliers, then this  
will apply to that, too.  That is, if you use a simple model of CMY,  
then this is possible.

I have not figured out how to do general color transformations with  
ink.  I have been thinking of RGB inks that might be used for a  
general matrix multiply of the color, but have not suggested  
anything.  There you will need to fiddle with the image.  That is,  
all computation seems to be within each color channel, there is no  
cross over.  If I understand this right, that means no gray, no  
sepia, no color-blindness transformations, and so on.

Even so, I think it is cool that what once needed time consuming  
image processing now is done with ink.

This is the techy answer.  Others would be better with the art, graft  
and lore.

Dar




More information about the use-livecode mailing list