I working on a grails project with some image resizing using java.awt.Graphics2D. I'm doing a resize in order to have 5 sizes. The smallest size has width: 77 and height: 58. The problem is that for this size, the quality of the resized picture is really bad. I know about ImageMagic but I cannot change to it, I'm stuck with some java libraries. Here is my piece of code:
def img = sourceImage.getScaledInstance(77, 58, Image.SCALE_SMOOTH)
BufferedImage bimage = new BufferedImage(77, 58, BufferedImage.TYPE_INT_RGB)
Graphics2D bGr = bimage.createGraphics()
bGr.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY )
bGr.drawImage(img, 0, 0, null)
bGr.dispose()
I've tried differents hints but does not change the quality. We have an iOS app we really need to have sharp pictures. Does anybody have any idea how to improve the picture quality ?