List of utility methods to do BufferedImage Scale
Image | adjustScale(final BufferedImage bi, final JComponent component, final int insetX, final int insetY) DOCUMENT ME! final double scalex = (double) component.getWidth() / bi.getWidth(); final double scaley = (double) component.getHeight() / bi.getHeight(); final double scale = Math.min(scalex, scaley); if (scale <= 1d) { return bi.getScaledInstance((int) (bi.getWidth() * scale) - insetX, (int) (bi.getHeight() * scale) - insetY, Image.SCALE_SMOOTH); } else { return bi; ... |
ImageIcon | getScaledImageAsImageIcon(BufferedImage bufferedImage, int width, int height) get Scaled Image As Image Icon return new ImageIcon(bufferedImage.getScaledInstance(width, height, BufferedImage.SCALE_SMOOTH)); |
BufferedImage | ScaleToSize(BufferedImage bimg, int maxCols, int maxRows) Scale To Size if (maxCols == -1) maxCols = bimg.getWidth(null); if (maxRows == -1) maxRows = bimg.getHeight(null); if (maxCols == -1 || maxRows == -1) { Image srcImg = new ImageIcon(bimg).getImage(); maxCols = srcImg.getWidth(null); maxRows = srcImg.getHeight(null); ... |