List of utility methods to do BufferedImage to ImageIcon
ImageIcon | getImageIcon(BufferedImage img) This method is used for obtaining image icon from image. ImageIcon icon = new ImageIcon(img); return icon; |
ImageIcon | getImageIcon(final BufferedImage image) Converts the image to an imageicon. return new ImageIcon(image); |
ImageIcon | scaleImageToIconImage(final BufferedImage img, final int maxHeight, final int maxWidth, final boolean preserveAspectRatio, final boolean doHighQuality) Scales an image using a relatively fast algorithm. byte[] bytes = scaleImage(img, maxHeight, maxWidth, preserveAspectRatio, doHighQuality); if (bytes != null && bytes.length > 0) { return new ImageIcon(bytes); return null; |
JLabel | toSwingImage(final BufferedImage image) to Swing Image JLabel label = new JLabel(new ImageIcon(image)); label.setAlignmentX(JComponent.CENTER_ALIGNMENT); return label; |