How to

downscale images in a WebObjects

drawImage performance on Leopard

A not very fast but handy way to downscale images in a WebObjects application is using Java 2D APIs, with code like this: BufferedImage reducedImage = new BufferedImage(newX, newY, BufferedImage.TYPE_INT_RGB); Graphics2D g = reducedImage.createGraphics(); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED); g.drawImage(originalImage, 0, 0, newX, newY, 0, 0, originalImage.getWidth(), originalImage.getHeight(), null); g.dispose(); Although not blazing fast, …

drawImage performance on Leopard Read More »