# Processing resize images without blur?

**URL:** <https://discourse.processing.org/t/processing-resize-images-without-blur/39982>\
**Category:** Coding Questions\
**Created:** [December 2, 2022, 8:28am UTC](https://discourse.processing.org/t/processing-resize-images-without-blur/39982 "2022-12-02T08:28:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![turke1034](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/turke1034/32/16910_2.png) [@turke1034](https://discourse.processing.org/u/turke1034)\
**Post date:** [December 2, 2022, 8:28am UTC](https://discourse.processing.org/t/processing-resize-images-without-blur/39982/1 "2022-12-02T08:28:50Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [December 2, 2022, 8:53am UTC](https://discourse.processing.org/t/processing-resize-images-without-blur/39982/2 "2022-12-02T08:53:45Z")

</div>

Hi @turke1034,

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

[Processing Forum - image-resize-anti-aliasing](https://forum.processing.org/two/discussion/4040/image-resize-anti-aliasing.html)

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

> **[smooth() / Reference](https://processing.org/reference/smooth_.html)**
>
> Draws all geometry with smooth (anti-aliased) edges. This behavior is the default, so smooth() only needs to be used when a program needs to set the smoothing in a different way. The level para…

> **[noSmooth() / Reference](https://processing.org/reference/noSmooth_.html)**
>
> Draws all geometry and fonts with jagged (aliased) edges and images with hard edges between the pixels when enlarged rather than interpolating pixels. Note that smooth() is active by default, s…

---

<div class="post-metadata">

**Author:** ![turke1034](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/turke1034/32/16910_2.png) [@turke1034](https://discourse.processing.org/u/turke1034)\
**Post date:** [December 2, 2022, 9:10am UTC](https://discourse.processing.org/t/processing-resize-images-without-blur/39982/3 "2022-12-02T09:10:18Z")

</div>

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!)

---

<div class="post-metadata">

**Author:** ![mnse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnse/32/16520_2.png) [@mnse](https://discourse.processing.org/u/mnse)\
**Post date:** [December 2, 2022, 3:25pm UTC](https://discourse.processing.org/t/processing-resize-images-without-blur/39982/4 "2022-12-02T15:25:29Z")

</div>

Hi @turke1034,

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

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

```

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

Cheers  
— mnse

---

<div class="post-metadata">

**Author:** ![turke1034](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/turke1034/32/16910_2.png) [@turke1034](https://discourse.processing.org/u/turke1034)\
**Post date:** [December 2, 2022, 10:54pm UTC](https://discourse.processing.org/t/processing-resize-images-without-blur/39982/5 "2022-12-02T22:54:52Z")

</div>

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

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

```

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

---

<div class="post-metadata">

**Author:** ![behreajj](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@behreajj](https://discourse.processing.org/u/behreajj)\
**Post date:** [December 3, 2022, 1:02pm UTC](https://discourse.processing.org/t/processing-resize-images-without-blur/39982/6 "2022-12-03T13:02:48Z")

</div>

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

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

```

The field comes from [here](https://github.com/processing/processing4/blob/main/core/src/processing/opengl/PGraphicsOpenGL.java#L374). The setter is [here](https://github.com/processing/processing4/blob/main/core/src/processing/opengl/PGraphicsOpenGL.java#L1969). The constants are listed [here](https://github.com/processing/processing4/blob/main/core/src/processing/opengl/Texture.java#L56).

There’s also a [hint](https://processing.org/reference/hint_.html) to disable texture mip maps, fwiw.

---

<div class="post-metadata">

**Author:** ![turke1034](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/turke1034/32/16910_2.png) [@turke1034](https://discourse.processing.org/u/turke1034)\
**Post date:** [December 13, 2022, 1:39am UTC](https://discourse.processing.org/t/processing-resize-images-without-blur/39982/7 "2022-12-13T01:39:09Z")

</div>

oh my gosh thank you…
