Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Slick scale Image without anti-aliasing

In the Slick library (based off of LWJGL), you can scale images after you load them with getScaledCopy, but it will apply anti-aliasing. I want the edges to stay rough; I'm making pixel art. How can I do this?

like image 465
Jwosty Avatar asked May 30 '12 00:05

Jwosty


1 Answers

Based on the comments:

The documentation implies that the filter property of Images controls how images are scaled. To scale an image without smoothing, use the nearest neighbour filter:

Image original = …;
original.setFilter(Image.FILTER_NEAREST);
Image scaled = original.getScaledCopy();
like image 182
millimoose Avatar answered Oct 08 '22 23:10

millimoose