views:

213

answers:

2

I have an image loaded into an Image control and I'd like to know the most efficient way that I can darken/lighten the image programatically.

+1  A: 

Check out Adobe's BitmapFilter class. You can do some pretty cool things with it. Especially take a look at its derived classes and their usage examples.

Robusto
Thanks Robusto, the ColorMatrixFilter and ShaderFilter both work great - and there are a lot of other things as well!
Jason W
A: 

Although I went with Robusto's method, I also found this that works well

var a:Number = value * 11;
var b:Number = 63.5 - (value * 698.5);
redValue = greenValue = blueValue = a;
redOffset = greenOffset = blueOffset = b;
var cmf:ColorMatrixFilter = new ColorMatrixFilter(a, 0, 0, 0, b, 0, a, 0, 0, b, 0, 0, a, 0, b, 0, 0, 0, 1, 0);

It was taken from here, Image Manipulation In Flex and there is much more image altering fun as well.

Jason W