Flex: How to adjust the contrast / brightness of an image inside an image control?

I have an image loaded into a control Image

and I would like to know the most efficient way I can darken / lighten the image programmatically.

+2


a source to share


2 answers


Check out the Adobe BitmapFilter class. You can do some pretty cool stuff with it. Take a special look at its derived classes and examples of their use.



+2


a source


Although I went with Robusto method, I also found this, which 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);

      



This is where "Manipulating Images in Flex" was taken , and a lot more fun with modifying images.

0


a source







All Articles