Display Image in Center of Screen?

I have an image I need to display in the dead center of the screen. I'm using "Show Picture" but I need it to draw in the center of the screen. I could just use the "Direct Designation" and aim for the middle, but I want to make sure it's in the center for all resolutions. I've tried using the "Center" option from the dropdown, but the picture fails to appear at all when doing that.

Question: Is there a way to store the game's X and Y resolutions to be used as a variable? That way I could simply (X_resolution/2)+(Y_resolution+2) = coordinates to draw image.

Any assistance would be greatly appreciated. Thanks!
You haven't specified which maker this is for. However, using the "center" option, 0,0 should be dead centre of the screen no matter the resolution.
Hello, try this:
Graphics._width and Graphics._height

Example (MV/MZ):
JavaScript:
$gameScreen.showPicture(1,'MyPic',1,Graphics._width/2,Graphics._height/2,100,100,255,0);
..."center"...centre
I don't have anything to say, this just amused me 🙂

I've tried using the "Center" option from the dropdown, but the picture fails to appear at all when doing that.
I would suggest before/rather than resorting to script calls, you figure this out. It implies to me that something is wrong with your picture that calling the same function in a different way won't resolve.

Is your image of a resolution that fits within your game window? Does the canvas size match the image dimensions?
The lazy solution: check your game resolution (lets say 1280x720) make that exact same resolution transparent image on an image editor, add your desired image, center it as you want, save in pictures folder and use display picture with default settings, the image will be centered whitout any need for variables/tweaks.
Since this is directly tied to the game native resolution, fullscreening or altering the game window size will adjust the image accordingly.
I don't have anything to say, this just amused me 🙂


I would suggest before/rather than resorting to script calls, you figure this out. It implies to me that something is wrong with your picture that calling the same function in a different way won't resolve.

Is your image of a resolution that fits within your game window? Does the canvas size match the image dimensions?
It's super weird. I tell it to display in the upper left, and it draws the picture without issue. But if I tell it to draw to the center, it doesn't appear at all. It's literally the only thing I'm changing (upper-left vs center). I don't know what else would be making it not appear. There's nothing in the room other than the Player Character and the Room GM to handle the script. It's a major head scratcher.

The lazy solution: check your game resolution (lets say 1280x720) make that exact same resolution transparent image on an image editor, add your desired image, center it as you want, save in pictures folder and use display picture with default settings, the image will be centered whitout any need for variables/tweaks.
Since this is directly tied to the game native resolution, fullscreening or altering the game window size will adjust the image accordingly.
That's a pretty smart way to handle it! Thanks! If I can't figure out why the picture stops appearing when I select "center" then I'll likely use this solution. Much obliged!
I don't have anything to say, this just amused me 🙂


I would suggest before/rather than resorting to script calls, you figure this out. It implies to me that something is wrong with your picture that calling the same function in a different way won't resolve.

Is your image of a resolution that fits within your game window? Does the canvas size match the image dimensions?
I said center in the quote because that's literally what the option is called in the dropdown, and centre outside of that because that's how I spell it where I'm from. 😛
@Trihan I understand exactly why you typed that way! As I said, no criticism, just amusement 🙂
But if I tell it to draw to the center, it doesn't appear at all.
That's because you're not telling it where to draw the image, you're telling the software where the origin is for all the other parameters to effect it. So for example, with a top left origin, using the scale image options to scale up the image will scale the image diagonally right and downward. From the center, the image will scale outward in all directions.
These origin points are based on the image file, so either top left of the associated image or center of the associated image.
What I explained was accordingly. Sorry if I misunderstood:
but I want to make sure it's in the center for all resolutions

About working with images with a transparent background, maybe some API can read the image and consider only the non-transparent parts. But I think this is unnecessary.
I'm going to assume you're using MZ.

I've moved this thread to MZ Support. Thank you.

You haven't specified which maker this is for. However, using the "center" option, 0,0 should be dead centre of the screen no matter the resolution.
i'm using MV and have imported a picture. i set it to center 0,0 but it keeps popping up in the top left corner of the screen still and i have double checked to make sure it saved as center 0,0. im starting to get frustrated with this engine ;-;
i'm using MV and have imported a picture. i set it to center 0,0 but it keeps popping up in the top left corner of the screen still and i have double checked to make sure it saved as center 0,0. im starting to get frustrated with this engine ;-;
I was actually incorrect. You still need to put in the coordinates of the centre of your resolution.

@Amalbert26, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

If you need help with something, please make your own thread describing the issue.

Original thread: https://forums.rpgmakerweb.com/threads/display-image-in-center-of-screen.152977/