Text to Image to file

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
User avatar
sanddrizzle
Newbie
Posts: 5
Joined: Mon Mar 18, 2013 10:05 am
Location: Denmark
Contact:

Text to Image to file

#1 Post by sanddrizzle »

Hello.
I've been trying futilely to turn a Text object into an Image object, so that I can use renpy.load_surface on it. Can it be done? (I think it used to be possible through LiveComposite, but apparently that's been deprecated.)
My goal is to make an image generator which allows the user to combine various image files from the image folder while adding text along the way. Note that the final file isn't intended to be shown with renpy again, and I really do need it as an actual image file on disk. (Taking a screenshot doesn't give me the image quality i need.)
The reason I need renpy.load_surface, is because I know how to accomplish what I want with pygame, in particular combining stuff and saving the composite image to a file. However, the font modules of pygame seem to be unavailable in renpy (since it has it's own font system), so I need to use Text and then somehow figure out a way to get it onto a pygame surface, which the above method would accomplish (as it doesn’t seem possible to save renpy objects to an image file).
I've tried fooling around with renpy.render and blitting the Text but failed to end up with anything useful. Whichever road I take, I seem to come back to not being able to transform text into an image.
Help?

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Text to Image to file

#2 Post by PyTom »

No, this can't be done. Text is only available on the GPU, and so can only come back as a screenshot.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
sanddrizzle
Newbie
Posts: 5
Joined: Mon Mar 18, 2013 10:05 am
Location: Denmark
Contact:

Re: Text to Image to file

#3 Post by sanddrizzle »

Thanks for the reply, PyTom. :)
It is as I feared then. I did realize that I was fooling around with stuff outside of renpy's intended area of operation. Oh well, I can still make the most important parts work, and I actually do have a workaround, but it's rather rugly, so I shall have to consider whether I want to just leave text out.

Post Reply

Who is online

Users browsing this forum: No registered users