Home Artists Posts Import Register

Downloads

Content

here's two small functions that I'm going to use for my new renpy gallery, they are necessary for scaling images that are bigger than the screen.
since they can be useful for other uses as well I thought it would be a good idea to share it with my patreons and explain how to use it.

the get_image_size is simple, you'll give it an images address to get it's width and height in a tuple, here is the example you've seen in the video.

text str(get_image_size("img2.jpg"))


the image_fit needs the images address and the box size you want to fit the image in and returns the zoom level  you need to fit the image to that box:

add "img2.jpg" zoom image_fit("img2.jpg", [1920,1080])

in this example the image will be fitted in the screen size that is 1920x1080


it also returns 1 to keep the image size the same if the images size is smaller than the given frame size, you can upscale the smaller images if needed by adding a 0 as a flag to the arguments.

add "img2.jpg" zoom image_fit("img2.jpg", [1920,1080], 0)

to add it to your game add the attached file to the game folder, it is added to the "0GUI" as well if you've downloaded it after this post.

Files

image fit for renpy

here's two small functions that I'm going to use for my new renpy gallery, they are necessary for scaling images that are bigger than the screen. since they can be useful for other uses as well I thought it would be a good idea to share it with my patreons and explain how to use it. the get_image_size is simple, you'll give it an images address to get it's width and height in a tuple, here is the example you've seen in the video. text str(get_image_size("img2.jpg")) the image_fit needs the images address and the box size you want to fit the image in and returns the zoom level you need to fit the image to that box: add "img2.jpg" zoom image_fit("img2.jpg", [1920,1080]) in this example the image will be fitted in the screen size that is 1920x1080 it also returns 1 to keep the image size the same if the images size is smaller than the given frame size, you can upscale the smaller images if needed by adding a 0 as a flag to the arguments. add "img2.jpg" zoom image_fit("img2.jpg", [1920,1080], 0) to get it and my other bits check my patreon: https://www.patreon.com/KiaAzad or my steemit blog: https://steemit.com/@kiaazad

Comments

No comments found for this post.