PDA

View Full Version : RGB to Grayscale



sunita
May 9th, 2005, 07:05 AM
can i change the image color from RGB to Grayscale in flash mx 2004 with Action script

senocular
May 9th, 2005, 07:21 AM
no. There are no controls for saturation. You would need to import a separate grayscale image.

sunita
May 9th, 2005, 07:25 AM
no. There are no controls for saturation. You would need to import a separate grayscale image.

their must be some script for images or movieclip or for flv to change the saturation, plz help

sunita
May 9th, 2005, 07:35 AM
their must be some script for images or movieclip or for flv to change the saturation, plz help

like if we have 10 image and user click on one image then other images shoud convert to gray except selected

benFusion
May 9th, 2005, 01:26 PM
I don't think there is any way to do that with actionscript. You would have to go into Photoshop or some other graphics program and make them greyscale there and then import the images alongside the colored ones.

Then it's just a matter of actionscripting and tweening the transitions.

rmo518
May 9th, 2005, 08:52 PM
Flash color effects allow you to colorize, but they do not allow desaturation becuase the Color class uses the RGB model and cannot do a good job of separating color from brightness. Like everyone else is saying, if you want a desaturated image you will have to do it outside of Flash

However you can use actionScript to create some other effects that may work for what you are trying to do. The code below assumes you have a movie clip with the instance name "picture".

myColor = new Color(picture);
// washout effect; may be a reasonable alternative to greyscale
colorScheme = {ra:100, rb:150, ga:100, gb:150, ba:100, bb: 150, aa:100, ab:0};
myColor.setTransform(colorScheme);
You can create other effects by changing the colorScheme variable as follows:

// inverts the colors in your image
colorScheme = {ra:-100, rb:255, ga:-100, gb:255, ba:-100, bb: 255, aa:100, ab:0};

// boost the red
colorScheme = {ra:500, rb:-500, ga:100, gb:0, ba:100, bb: 0, aa:100, ab:0};

// darken the image
colorScheme = {ra:-150, rb:100, ga:-150, gb:100, ba:-150, bb:100, aa:100, ab:0};

// neutral colors - returns the image to its original color
colorScheme = {ra:100, rb:0, ga:100, gb:0, ba:100, bb: 0, aa:100, ab:0};
And there are lots of variations you can come up with too all without importing two versions of every image you want to use.

Hope this helps.