[Solved] Altering the appearances of Dynamic Images

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

[Solved] Altering the appearances of Dynamic Images

#1 Post by kivik »

Now that we can use variables to create dynamic images, I really want to take advantage and apply Image Manipulations to them, such as desaturating them on characters not speaking.

Unfortunately when I use the im. functions it doesn't seem to transpose the variable names into a filename, and therefore throws an error.

Is there a way I could put dynamic images into im. functions?
Last edited by kivik on Tue Apr 17, 2018 8:51 am, edited 2 times in total.

philat
Eileen-Class Veteran
Posts: 1900
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Image Manipulators on Dynamic Images

#2 Post by philat »


kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Altering the appearances of Dynamic Images

#3 Post by kivik »

Ah I didn't see that sorry. So if im are being phased out, is there any way of say, desaturating a dynamic image?

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Altering the appearances of Dynamic Images

#4 Post by kivik »

Ok I kinda hacked an ugly solution to my problem, but I'd really welcome anyone with a better solution. In my case I couldn't see a way of changing saturation so I created a black 25% opacity overlay image and did the following:

Code: Select all

define config.speaking_attribute = "speaking"
image catherine = AlphaMask(LiveComposite((667,1080),
    (0,0), "portrait/catherine/[catherine.makeup]-[catherine.outfit]-[catherine.get_contentment.state].png",
    (0,0), "grey.png",), 
    DynamicImage("portrait/catherine/[catherine.makeup]-[catherine.outfit]-[catherine.get_contentment.state].png"))
image catherine speaking:
    "portrait/catherine/[catherine.makeup]-[catherine.outfit]-[catherine.get_contentment.state].png"
grey.png is the same size as my portrait, and is placed on top of my DynamicImage thus making it darker. Then by reusing the DynamicImage as the mask, it cuts out the unwanted grey.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Altering the appearances of Dynamic Images

#5 Post by kivik »

Okay so the above code seems to work at first glance, until my variables changed and the DynamicImage (the mask) doesn't get updated. I've tried forcing image prediction or disabling it with no luck.

So I'm just completely at a loss at how to grey out non-speaking characters dynamically without doubling my images like I did in a previous game by creating greyed out version of characters.

philat
Eileen-Class Veteran
Posts: 1900
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Altering the appearances of Dynamic Images

#6 Post by philat »

There is no way to change the saturation with ATL. The following should work more or less, some fiddling probably required to get it the way you want.

Code: Select all

transform mask:
    alpha 0.2

transform darken(child):
    AlphaBlend(At(child, mask), child, Solid("#000"), alpha=True)

image char = At("images/[var].png", darken)

image char speaking = "images/[var].png"

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Altering the appearances of Dynamic Images

#7 Post by kivik »

Nice! Thank you philat! That works exactly as I want and is so much simpler :)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]