We're making a simple 2D game in Java. Every time we draw images they are jagged and look awful. We can anti-alias the text, but our images are in non-vector formats, so we can not apply anti-aliasing to them. We want to smooth our .JPG images (they were created with the maximum quality in Photoshop): is there a way to programmatically accomplish this?
BufferedImage goplaybut = ImageIO.read(getClass().getResourceAsStream("/gameover/goplaybut.jpg"));
g.drawImage();
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Try adding some interpolation:
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With