centenond
centenond

Reputation: 1198

image quality loss when scaling down

My image is 200px x 200px size. When I'm trying to draw it as 100px x 100px the image is being rendered awfull and unacceptable.

@Override
public void render(SpriteBactch batch){
    batch.begin();
    batch.draw(img, 0, 0,100,100);
    batch.end();
}

When I'm drawin it like this:

@Override
public void render(SpriteBactch batch){
    batch.begin();
    batch.draw(img, 0, 0);
    batch.end();
}

it has acceptable quality. Can i fix this and how? Below you can find screenshot from image rendering:

enter image description here

Upvotes: 2

Views: 561

Answers (1)

m.antkowicz
m.antkowicz

Reputation: 13571

try to apply your Texture Linear TextureFilter

    Texture texture = new Texture(... //creating your texture

    texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); //add this line

    Sprite img = new Sprite(texture);

Please notice that when you are scaling picture down there is always quality loose risk so you can still can be not satisfied with the result.


To get some information about TextureFilter and how to deal with them just read:

http://www.badlogicgames.com/wordpress/?p=1403

Upvotes: 4

Related Questions