# How do I scale up pixel art without blur in GM Studio?

I'm creating a game in Game Maker Studio that uses pixel art. When I launch the game, all scaled-up textures are really blurry. (It doesn't happen to small ones.)

For example, this image

renders in the game like this:

Is there anyway to resize small pixels into big pixels instead of blurred pixels?

• don't use a lossy compression for textures instead use bmp, gif or png, they all support lossless storage – ratchet freak Nov 22 '13 at 9:48
• When you have pixel art, you usually want to avoid any resizing, because pixel art always suffers from that. When resizing can't be avoided, it should use nearest-neighbor interpolation to preserve the crispy look. When you want resizing, use vector-graphics instead of raster-graphics. I unfortunately can't help you with that because I am not familiar with GMStudio. – Philipp Nov 22 '13 at 9:50
• examples added. – mpower Nov 22 '13 at 10:16
• I don't know game makers possibilities but you would want to disable all scale-filtering and enable nearest-neighbor scaling. – Appleshell Nov 22 '13 at 10:59
• If I remember correctly, the original Spelunky (made in Game Maker) had a DLL that enabled linear scaling. The source is available at that link; have a look. – Anko Nov 22 '13 at 12:21

Found a solution from some resource. Go to Global Game Settings, then go to any platform spoiler(for example "Windows" or "Android"), there choose the spoiler titled "Graphics" and toggle "Interpolate colors between pixels" off. Have fun :)

• This technically works, though pixel art may result altered due to scaling up with a non-integer factor (e.g. 2.5x) – liggiorgio May 30 '17 at 12:33
• You mean they didn't bother to make that the default setting?!? I just checked and that it default the other way in game maker 8.0. This is just nuts.... Great answer btw. – user64742 Jun 3 '17 at 23:56

Nobody wants to deal with having to manually scale up every sprite; not only is it a sloppy workspace but it yields to be very unprofessional. I found a solution when turning off interpolation in global game settings didn't work.

texture_set_interpolation(false);


:) I hope this helps you in your future endeavors.

• This is the best solution if targetting multiple platforms, you don't have to click on "Interpolate colors between pixels" for every single platform! Exactly what I was looking for. – Logan Pickup Sep 25 '16 at 5:25

What I do generally for this is either using photoshop or GIMP ( scale/Nearest Neighbour)

But to do it in the GM:S sprite editor itslef, I use the Stretch command instead of scale and set it to POOR quality. That will keep the Blocky sort of feel

Above is a game im workin on ATM, i did just that!

• Although this does work for up-scaling on certain resolutions it won't for all of them, GM also has a habit of compressing textures by default. This would also scale differently on different resolutions when using stretch functionality, this will cause the blur we are trying to avoid. However, +1 for the (Scale/Nearest Neighbour) mention. – Tom 'Blue' Piddock Mar 7 '14 at 10:07

Turn off the scale function in the backgrounds tab in the map. If it seems out of scale make sure your texture for the back ground is the same size as the room/map you're in.

Alternatively use this post here to create a background script that will upscale the back ground with (hopefully) crisp results.

This utilises surfaces so if you need some extra help on that - this post provides a lot of information.

EDIT:

Going back on my answers I realized this is not up to scratch and needs the tutorial content. Here it is:

STEP 1: Choose the scale you want. Use a view for every room and have the port W and port H scaled appropriately. So, for example, if you were using a scale of 2... it would look like this, in GM's room editor.

It is important that this is consistent for all rooms. If you have lots of rooms, it might be easier to do this via code*. I prefer to do it that way, because then the values aren't constant and I can support multiple different scales.

STEP 2: Create 3 scripts, screen_init, screen_begin, and screen_end. Here is what goes in each of the scripts...

Quote from: screen_init

// screen base(view_wview and view_hview)
screen_x = 0;
screen_y = 0;
screen_w = 320;
screen_h = 240;
screen_scale = 2;

// create a surface for the whole screen to be drawn on
screen = surface_create(screen_w,screen_h);

// this will destroy the screen object if surfaces are not supported on the graphics card, reverting to the viewport method
if screen = -1{instance_destroy();}


Quote from: screen_begin

// this draws the surface on the screen
surface_reset_target();
draw_clear(0);
draw_set_blend_mode_ext(bm_one, bm_zero);
draw_surface_stretched(screen,screen_x,screen_y,screen_w*screen_scale,screen_h*screen_scale);
draw_set_blend_mode(bm_normal);
screen_refresh();


Quote from: screen_end

// this sets surface 'screen' as the drawing target for everything in the game, so all drawing will be done on this surface and not on the game screen
surface_set_target(screen);


STEP 3: Now we have are scripts, but where do they go? Create an object. Like, obj_screen, objScreen, o_screen, or whatever, and do the following:

• A) place the screen_initscript in the Create event.
• B) place the screen_begin script in the Begin Step event.
• C) place the screen_end script in the End Step event.

And place that object in the first and foremost room of your game, mark it persistent, and make sure there are no duplicates of it.

You're done, and now have nice, crisp scaling =D

• I want to scale it without blurring since I love pixel arts.so this doesn't answer my question.Is this possible? – mpower Nov 22 '13 at 10:48
• Not likely, Game Maker studio does scaling with a bad up scaling algorithm which often makes the undesired scaling blur. Use the tutorial I just edited in my answer to try a crisp background with scaling. – Tom 'Blue' Piddock Nov 22 '13 at 10:54
• Did you consider pre-scaling your background texture in a graphic program? – Philipp Nov 22 '13 at 11:48
• Two ways are good.first combining some of scripts up here.second is pre-scaling images before using them. – mpower Nov 22 '13 at 12:46
• Excellent, glad it helped. – Tom 'Blue' Piddock Nov 22 '13 at 15:00

Use texture_set_interpolation(false) to make it draw them as is.

• This might be correct, but could you go in to any more detail? We normally look for a bit more detail, in our answers. – Gnemlock May 30 '17 at 3:17