final int width = Math.max(1, (int) (scale * dim.width));
final int height = Math.max(1, (int) (scale * dim.height));
final BufferedImage bi = ImageUtils.createTransparentImage(width, height);
final Graphics2D graph = bi.createGraphics();
graph.setBackground(new Color(0, 0, 0, 0));
graph.setTransform(AffineTransform.getScaleInstance(scale, scale));
drawable.draw(graph, new Rectangle2D.Float(0, 0, dim.width, dim.height));
graph.dispose();