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?
Asked
Active
Viewed 3,372 times
6

Jwosty
- 3,497
- 2
- 22
- 50
-
4Wild guess based on the javadocs: try using [`setFilter()`](http://slick.cokeandcode.com/javadoc/org/newdawn/slick/Image.html#setFilter(int)) to set the image filter to [`FILTER_NEAREST`](http://slick.cokeandcode.com/javadoc/org/newdawn/slick/Image.html#FILTER_NEAREST) before scaling the image. – millimoose May 30 '12 at 00:56
-
This worked, thanks! Post this answer and I'll accept it ;) – Jwosty May 30 '12 at 01:24
1 Answers
7
Based on the comments:
The documentation implies that the filter
property of Image
s 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();

Community
- 1
- 1

millimoose
- 39,073
- 9
- 82
- 134