Can someone please help me resolve this issue. I've tried searching myself and the common answer suggested is to use a TextureFilter. I've tried doing that multiple times but nothing works. My png resolution is 1024x1024, and I'm trying to shrink it's size to fit on screen. This is the kind of result I'm getting, you can see that the circle looks very pixelated, despite the actual image having anti-aliased edges.

enter image description here

[The original image is here.]

Here's the code:

    SpriteBatch batch;
    Texture img;
    Sprite sprite;

    public void create () {
        batch = new SpriteBatch();

        img = new Texture("circle.png");
        img.setFilter(TextureFilter.Linear, TextureFilter.Linear);

        sprite = new Sprite();

    public void render () {

        batch.draw(img, 0, 0, 128, 128); //draw texture -- reduced size
        batch.draw(sprite, 200, 200, 128, 128); //draw sprite -- reduced size
        batch.draw(img, 250, 250); //draw texture -- original size
  • \$\begingroup\$ Have you explored the other options in TextureFilter, such as Nearest, MipMap, etc.? \$\endgroup\$ – Alexandre Desbiens Jan 19 '16 at 16:53
  • \$\begingroup\$ @AlexandreDesbiens Yes I have. If I try, for example, MipMapLinear, Linear, my image turns into a black box for some reason. Other options either result in a black box or the same images I have above. \$\endgroup\$ – Jonathan Jan 19 '16 at 16:54
  • 1
    \$\begingroup\$ MipMap linear is probably exactly what you're looking for, but you need to make sure to generate the mip maps on the texture first. \$\endgroup\$ – Alex Sherman Jan 19 '16 at 17:30

As suggested in the comments, you should try to use Tri-Linear filtering and MipMaps. The reason using TextureFilter.MipMapLinearLinear results in a black box is that you haven't generated the texture with MipMaps. In order to do so, simply pass a second parameter to the Texture constructor as true like so:

img = new Texture("circle.png", true);
  • 2
    \$\begingroup\$ Actually, that should be img = new Texture(Gdx.files.internal("circle.png", true)); It worked though, so thank you! \$\endgroup\$ – Jonathan Jan 19 '16 at 17:38

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.