Does PGraphics.image() modify colors at the borders?

This is the source image

.
Init is drawn onto a red surface with some alpha, but the image itself is drawn at 255 alpha (using image method), and i checked the source image, the bottom, top and right border do not have any alpha <255 (the entire .png is full 255 alpha on all pixels). But still the border seems slightly tinted. This is a downscaled image.

In

you can see an upscaled image, but the borders still seem to have a slightly deviating color. In you can see another image with white at the bottom border, it doesn’t seem to have any tint.

I’ll probably not find an answer here, but I couldn’t think of a reason why that was happening so I thought I might as well try and ask.

After uploading, I am even more confused, the image also seems to have a dark border when embedded in the post, but if you click it to see the original version or open it in an image editing tool there is no border like that.

1 Like

did you try noStroke(); before image()?

Did you try noSmooth(); prior to it?

1 Like

In my prior testing I didn’t find noStroke() to change the image, but since both images use the same code and the border also seems to just be a darker version of the rest, that’s probably not it.

But I actually didn’t know about noSmooth(), and would also explain the darkening, so that might just be the cause.

Besides noSmooth(), you may try out set() & background() to display a PImage:

  1. Processing.org/reference/set_.html
  2. Processing.org/reference/background_.html
1 Like

even using noSmooth at tthe beginning of the script and never calling smooth ever again and using set to draw the image instead doesn’t seem to solve the problem, there is still obvious aliasing going on when I drag the image over my screen, where it draws a clearer border when the background is lighter

I went into to the smooth method in the class file and my IDE couldn’t find any references, I call noSmooth at the beginning in settings, since it also gives a warning when called anywhere else. I tried with set() and with image() separately, but they both seem to look the same. To note is that it seems to be with some images only, others don’t seem to anti-alias.

I’ll spare you the images right now, but basically some images give off a dark border when over light colors, and if you drag the image around, the border moves accordingly.

Perhaps that has to do with processing accepting float inputs for image positions, so it automatically gives an alpha for non-integers values? But then again, that would have probably made a difference in the set() method, since that only accepts ints.

Are you using P2D or P3D as your renderer – or the default size(w, h) which uses JAVA2D?

yes, i just use size, which should result in JAVA2D