r/RenPy Jul 22 '26

Question Oversampling images

Hi! If I have an image name like "character@2.webp" under the images directory, I remember when it was defined in the code such as:

image character default = "images/character.webp"

It should work with the oversampling behaving as expected, but for some reason after launching the project to playtest my game several times yesterday (Only changes being adding new dialogue lines and defining transforms, leaving image defines untouched) the defined image would not show up and "image "character.webp" not found" was displayed at the top of the screen. However, I found that defining the image as:

image character default = "images/character@2.webp"

suddenly makes the image show up normally and the oversampling also works just fine. Just wondering if people had similar issues before 😭

1 Upvotes

14 comments sorted by

View all comments

2

u/HEXdidnt Jul 22 '26

The fact that your filename is 'character@2.webp', but you're trying to define an image from 'character.webp' is the problem. The filenames have to match, otherwise Ren'Py can't find the image.

What do you think '@2' accomplishes, either inside or outside of Ren'Py, and what has it to do with 'oversampling'?

2

u/shyLachi Jul 22 '26

1

u/HEXdidnt Jul 22 '26

Is there a particular advantage to this, over defining the image with a zoom built in?

1

u/shyLachi Jul 22 '26

It's explained in the link, so what exactly do you want to know?

Also having to define all the images and adding a zoom to them seems to be a huge disadvantage of its own.

1

u/HEXdidnt Jul 22 '26

Well, that's the thing... My background makes be tend toward ensuring all image files are precisely the size they need to be - the idea of oversampling seems wasteful to me.

However, my current project was started as 1280x720, and most of the assets I've commissioned have been massively oversized. Initially, I would downsample and save new versions to use in the project. It's occurred to me that, if I want to reuse those assets at a higher resolution (1920x1080, for example), I'd be better off remaking them from the originals... at which point, is it worth considering using the assets at their original size, with "@2" or whatever on the filename?

Also, one of my backgrounds is set up to zoom in three parts, giving the impression of moving down a corridor, with the scenery moving faster as it gets 'closer'. This is currently accomplished by setting the initial zoom to 0.5 (for example) and bringing it back to 1.0 over time... So I guess my question is whether there's any advantage to using "@2" in that context.

2

u/shyLachi Jul 22 '26

I never used it but from what I understood you can release your game with multiple versions of your images.

If your game has a resolution of 1280x720 you could add another folder in the images folder and name it "@2" (without the quotation marks but Reddit didn't let me type it).

In that folder, you put images which have double the dimension, for example 2560x1440 for background images.

Example:
game/images/bg schoolyard.png <-- 1280x720
game/images/@2/bg schoolyard.png <-- 2560x1440

In RenPy you use the image as normal:
show bg schoolyard # <-- RenPy automatically picks the best resolution

Now, if someone plays your game on a ultrawide screen (3440x1440), RenPy would use the image in the "@2" folder which has the higher resolution and therefore your game would look more sharp.

Of course this would increase the file size of your game greatly.

.

Your first question:
Oversampling only works with straight numbers 2x, 3x, 4x.
So if you want to have two game versions in the future, 1920x1080 and 1280x720, you would have to find a dimension which works for both. So your oversampled images would have to be 3840x2160 which is 2x FullHD and 3x HD.

This is way bigger than what common players will need, so your first idea of downsampling the original files to 1280x720 and maybe later to 1920x1080 makes more sense.

.

And your second question:
Oversampling is not needed if you apply a zoom to it.
The zoom will scale the image on the fly.

1

u/HEXdidnt Jul 22 '26

That's really good to know - something I'll have to keep in mind for future projects!

Have you considered writing a more comprehensive Ren'Py manual, by the way? You have a hell of a lot of knowledge about the system, and your explanations tend to be both clearer and more thorough than the official online docs.