Processing resize images without blur?

I’ve done extensive research for this, but I can’t seem to find anything that works :frowning:

My problem is, my game is themed around pixel art however when resizing images in processing, the image becomes blurry. My goal is to resize my art without processing making it blurry. Any way would be appreciated, but keep in mind that I want the following:

  • clear/crisp representation of the image/s
  • same/comparable performance to standard processing performance

Hi @turke1034,

You can checkout this old thread about turning off anti aliasing:

Processing Forum - image-resize-anti-aliasing

You can see the documentation of the smooth() and noSmooth() functions:

I have that enabled, even though for some reason it has no effect. Maybe it is because I use P2D, but I really don’t want to use JAVA2D, sorry. (Also I tried using smooth(8) but it has the same effect as noSmooth() meaning noSmooth() doesnt work!)

Hi @turke1034,

you need to set on the setup right after size(...) the noSmooth();
ie:

void setup() {
  size(...);
  noSmooth(); // <-- set here
}

The smooth causes the blurring effect and is enabled by default!

Cheers
— mnse

This is my code inside settings() as I use processing as a library:

size(720, 480, P2D);
noSmooth();

Unfortunately this makes no difference, maybe it is a bug with processing 4?

I tried adding this line to setup and it seemed to work ok.

((PGraphicsOpenGL)getGraphics()).textureSampling(2);

The field comes from here. The setter is here. The constants are listed here.

There’s also a hint to disable texture mip maps, fwiw.

3 Likes

oh my gosh thank you…

1 Like