Java Utililty Methods BufferedImage to ImageIcon

List of utility methods to do BufferedImage to ImageIcon

Description

The list of methods to do BufferedImage to ImageIcon are organized into topic(s).

Method

ImageIcongetImageIcon(BufferedImage img)
This method is used for obtaining image icon from image.
ImageIcon icon = new ImageIcon(img);
return icon;
ImageIcongetImageIcon(final BufferedImage image)
Converts the image to an imageicon.
return new ImageIcon(image);
ImageIconscaleImageToIconImage(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;
JLabeltoSwingImage(final BufferedImage image)
to Swing Image
JLabel label = new JLabel(new ImageIcon(image));
label.setAlignmentX(JComponent.CENTER_ALIGNMENT);
return label;