# Smoothing loadImage()

**URL:** <https://discourse.processing.org/t/smoothing-loadimage/3096>\
**Category:** Processing\
**Created:** [August 29, 2018, 5:58pm UTC](https://discourse.processing.org/t/smoothing-loadimage/3096 "2018-08-29T17:58:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mloiz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mloiz/32/11462_2.png) [@mloiz](https://discourse.processing.org/u/mloiz)\
**Post date:** [August 29, 2018, 5:58pm UTC](https://discourse.processing.org/t/smoothing-loadimage/3096/1 "2018-08-29T17:58:05Z")

</div>

Hi,  
I work with an image which is smooth  
 ![tempppp](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c8ce6bae0986ecf4004f016ab1a1f21ed5e0ebb8.png)  
[source](https://patientensicht.ch/sites/patientensicht.ch/files/field/image/open_access_logo_plos_0.png)

but once I load and read it in Processing it looks like it loose some quality, see :  
 ![tempp](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c186559e15b9a5ab00bb031b4031af994a8f0ef2.png)

below is my code, all is in the `setup()` function.

```auto
 size( 700, 900);
  smooth(8);
  background(250);
  

  imageMode(CENTER);
  img = loadImage("img.png");
 image(img, xpos, ypos, w, h);

```

---

<div class="post-metadata">

**Author:** ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)\
**Post date:** [August 29, 2018, 8:38pm UTC](https://discourse.processing.org/t/smoothing-loadimage/3096/2 "2018-08-29T20:38:18Z")

</div>

Can we have the whole code to be able to run it home?

We don’t know the w and h value you are using.

---

<div class="post-metadata">

**Author:** ![mloiz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mloiz/32/11462_2.png) [@mloiz](https://discourse.processing.org/u/mloiz)\
**Post date:** [August 29, 2018, 8:43pm UTC](https://discourse.processing.org/t/smoothing-loadimage/3096/3 "2018-08-29T20:43:03Z")

</div>

yes :

```auto

PImage img = new PImage();
img = loadImage("../img.png");
imageMode(CENTER);
size(650, 1050);
smooth(8);
background(255);
int s = 40;

image(img, width/2, height/2, s * 640/100, s * 1000/100);

```

in fact it happens when I reduce the size,  
when the size is the same (640\*1000) no pb…

---

<div class="post-metadata">

**Author:** ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)\
**Post date:** [August 31, 2018, 9:47am UTC](https://discourse.processing.org/t/smoothing-loadimage/3096/4 "2018-08-31T09:47:37Z")

</div>

I tried with the P2D renderer and the problem disappeared.

No need to add the `smooth(8)` line; the default behavior is smooth(2) and it should be enough.

If you can’t use the P2D renderer for some reasons, a workaround would be to create 2 or 3 versions of your image with photoshop or gimp to get different sizes and then depending of the size of the image you want to draw select the one that is the closest to avoid that problem.

Let us know how it goes! 🙂

---

<div class="post-metadata">

**Author:** ![mloiz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mloiz/32/11462_2.png) [@mloiz](https://discourse.processing.org/u/mloiz)\
**Post date:** [August 31, 2018, 10:04am UTC](https://discourse.processing.org/t/smoothing-loadimage/3096/5 "2018-08-31T10:04:25Z")

</div>

tks for the feedback,  
yes, I have reduce the img size before loading them.
