# How to change the size of a draw GUI?

I tried to create a HUD button with a sprite of dimensions 1200x1200 to decrease it by code, but I could not.

Code:

draw_sprite(spr_btnBig,0,100,100);
image_xscale=0.05;
image_yscale=0.05;

I tried also to modify the scale of the object in the options in the room, but did not obtain the expected result.

Result:

I would not want to have to decrease its size in a program other than the game maker, because the quality of a sprite resized in the game maker gets much higher than a resized in image editors like GIMP or Photoshop:

How could he do that?

draw_sprite() ignores image_xscale and image_yscale. Use draw_sprite_ext() instead.

P.S. Are you really need so high resolutions? It's very bad for memory. It won't work on most part of mobile devices, it won't work (or will work very slow) on big part of old desktops and laptops.

the game maker gets much higher than a resized in image editors like GIMP or Photoshop

I'm sure you're wrong. Photoshop has many algorithms for resizing. I think you tried a wrong one of them.

• Using high-res sprites and drawing them downscaled enhances graphics quality for avoiding upscaling artifacts; on the other hand, it's better having different resolution of the same sprite and choose the right one depending on target display resolution. – liggiorgio Mar 26 '17 at 15:50
• @liggiorgio I'm a professional game developer, and I'm perfectly know why may be need to use hires images and when. But this is not the case. – Dmi7ry Mar 27 '17 at 4:46
• What is the inert value to maintain the original color of the sprite? draw_sprite_ext(spr_btnBig,0,100,100,0.05,0.05,0,original color,1); – Boneco Sinforoso Mar 30 '17 at 1:00
• @BonecoSinforoso c_white. Default drawing is draw_sprite_ext(sprite_index, image_index, x, y, image_xscale, image_yscale, image_angle, image_blend, image_alpha) - it's same with draw_self(). But anyway you're going wrong way with that huge images. – Dmi7ry Mar 30 '17 at 3:57
• @BonecoSinforoso GMS resizes images according settings (Windows -> Graphics -> Texture Pages). For example, if you use 2048*2048 then GMS will downscale all images which are bigger. The size you need depends on what is your target platforms (mobile, desktop, etc). For example, if you want mobile devices, then just get display size of the modern device - that will be your max resolution (but keep in mind it won't work on low-end devices). Desktops - 1920*1080 (43% of Steam users) or 1366*768 (24%). Etc. Also it depends on your game. In some cases vector images will be better. – Dmi7ry Mar 31 '17 at 4:00

First of all, make sure you are drawing your button in the Draw GUI event, since you want it to be drawn relative to the display coordinates instead of world coordinates: this is for you may want to have different viewport size and GUI size (respectively modifiable via the view_wview[] and view_hview[] variables, and the display_set_gui_size() function.

That said, in the Draw GUI event of your button, you can gain more control on how to draw the button sprite by using some of the extended drawing functions, such as:

Also, when drawing in the Draw GUI event, coordinates are always relative to the GUI canvas, having origin in the top-left corner of the game window and having size equal to the viewport, unless you set it to other values.