1
\$\begingroup\$

Why does this border appear around the edges when I downscale a bitmap and how do I avoid it? I tried every filter I know, the results go from bad to worse.

Border problem

Here's the original bitmap:

original bitmap

\$\endgroup\$
  • 1
    \$\begingroup\$ I do not think changing your sampling filter is going to fix this... is this a pre-multiplied alpha image? I suspect you are not properly dealing with that. \$\endgroup\$ – Andon M. Coleman Jun 11 '14 at 7:03
1
\$\begingroup\$

I don't know libgdx, but the problem is with your image. There are low opacity, white-ish pixels all around the edges of the Moon (ARGB is around (1, 255, 255, 255))

It's important to be aware of the fact that all pixels in an image have R, G and B values, even the ones where alpha is zero, and they might cause artifacts during sampling. There is a detailed article on this here: article.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.