How can I draw smooth buffered images in java?

We are making a simple 2D game in Java. Every time we draw images, they are jagged and look awful. We can smooth text, but our images are in non-vector formats, so we cannot apply anti-aliasing to them. We want to smooth out our .JPG images (they were created with the highest quality in Photoshop): is there a way to programmatically do this?

enter image description here

BufferedImage goplaybut = ImageIO.read(getClass().getResourceAsStream("/gameover/goplaybut.jpg")); g.drawImage(); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 
+5
source share
1 answer

Try adding some interpolation:

 g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); 
+8
source

Source: https://habr.com/ru/post/1200611/


All Articles