Is there any way in corona to make a display object desatuated, a.k.a. black and white with code?

Hi,

Is there any way in corona to make a display object desatuated, a.k.a. black and white with code?

Like in image processing packages that you can decrease saturation of a picture and it would make it gradually black and white.

If not, is there any way at all to make a display image black and white?

Regards. [import]uid: 206803 topic_id: 35641 reply_id: 335641[/import]

Hi Aidin,
At this time, not really. If this is a one-tone image (unlikely) then you could create it in greyscale, apply a color tint, then gradually revert it back to greyscale in a loop. But if this is a multi-tone image, the effect simply wouldn’t look correct.

Depending on the size/complexity of your image (and if you don’t need to do this across dozens of possible images), you could make an animated sprite and desaturate the frames in your image editing program.

Brent [import]uid: 200026 topic_id: 35641 reply_id: 141707[/import]

How about using two images-- one full color, one b/w, and fade between the two? [import]uid: 4157 topic_id: 35641 reply_id: 141775[/import]

Thanks mates, how can I change tint? or fade between two images? [import]uid: 206803 topic_id: 35641 reply_id: 141823[/import]

Hi Aidin,
At this time, not really. If this is a one-tone image (unlikely) then you could create it in greyscale, apply a color tint, then gradually revert it back to greyscale in a loop. But if this is a multi-tone image, the effect simply wouldn’t look correct.

Depending on the size/complexity of your image (and if you don’t need to do this across dozens of possible images), you could make an animated sprite and desaturate the frames in your image editing program.

Brent [import]uid: 200026 topic_id: 35641 reply_id: 141707[/import]

How about using two images-- one full color, one b/w, and fade between the two? [import]uid: 4157 topic_id: 35641 reply_id: 141775[/import]

Thanks mates, how can I change tint? or fade between two images? [import]uid: 206803 topic_id: 35641 reply_id: 141823[/import]

* bump * [import]uid: 206803 topic_id: 35641 reply_id: 145378[/import]

Setup
* Load both the greyscale and colour images.
* Place both images at the same location with the greyscale one in front of the colour one
* Hide the greyscale image

Transition Effect

greyscaleImage.isVisible = true greyscaleImage.alpha = 0 transition.to( greyscaleImage, {alpha=1, time=500, onComplete=function() colourImage.isVisible=false end}) [import]uid: 171125 topic_id: 35641 reply_id: 145397[/import]

Thanks but I need to be able to do it on animated sprites as well.

What I’m trying to do is this: I have an animated sprite that I need to make some arbitrary percentages of it grayscale during gameplay.

But I can’t get my head around figuring out how to do it. [import]uid: 206803 topic_id: 35641 reply_id: 145484[/import]

Hi Aidin,
At this time, it’s not possible to internally desaturate a display object. That being said, while it’s a decent amount more effort, if you need this functionality, you could consider the following approach… it might work if you can set it up properly. Basically, it involves making different “parts” of your overall figure as distinct sprites and elements, which you can control to a greater degree.

http://www.coronalabs.com/blog/2012/10/09/dynamically-optimized-sprite-sheets/

Brent [import]uid: 200026 topic_id: 35641 reply_id: 145739[/import]

* bump * [import]uid: 206803 topic_id: 35641 reply_id: 145378[/import]

Setup
* Load both the greyscale and colour images.
* Place both images at the same location with the greyscale one in front of the colour one
* Hide the greyscale image

Transition Effect

greyscaleImage.isVisible = true greyscaleImage.alpha = 0 transition.to( greyscaleImage, {alpha=1, time=500, onComplete=function() colourImage.isVisible=false end}) [import]uid: 171125 topic_id: 35641 reply_id: 145397[/import]

Thanks but I need to be able to do it on animated sprites as well.

What I’m trying to do is this: I have an animated sprite that I need to make some arbitrary percentages of it grayscale during gameplay.

But I can’t get my head around figuring out how to do it. [import]uid: 206803 topic_id: 35641 reply_id: 145484[/import]

Hi Aidin,
At this time, it’s not possible to internally desaturate a display object. That being said, while it’s a decent amount more effort, if you need this functionality, you could consider the following approach… it might work if you can set it up properly. Basically, it involves making different “parts” of your overall figure as distinct sprites and elements, which you can control to a greater degree.

http://www.coronalabs.com/blog/2012/10/09/dynamically-optimized-sprite-sheets/

Brent [import]uid: 200026 topic_id: 35641 reply_id: 145739[/import]

@Aidin: For what it’s worth, this feature is part of Graphics 2.0. I’m looking to do the same thing!

@Aidin: For what it’s worth, this feature is part of Graphics 2.0. I’m looking to do the same thing!