public class ImageUtils
extends java.lang.Object
Constructor and Description |
---|
ImageUtils() |
Modifier and Type | Method and Description |
---|---|
static java.awt.image.BufferedImage |
getBufferedImage(java.awt.Image source)
Returns the buffered image corresponding to the given image
|
static java.awt.image.BufferedImage |
getBufferedImage(java.net.URL imagePath)
Returns the buffered image corresponding to the given url image path.
|
static java.awt.Image |
getBytesInImage(byte[] imageBytes)
Loads an image from a given bytes array.
|
static java.awt.Image |
getComposedImage(java.awt.Image leftImage,
java.awt.Image rightImage,
java.awt.image.ImageObserver imageObserver)
Creates a composed image from two images.
|
static javax.swing.ImageIcon |
getScaledEllipticalIcon(byte[] imageBytes,
int width,
int height)
Creates a elliptical scaled image.
|
static javax.swing.ImageIcon |
getScaledEllipticalIcon(java.awt.Image image,
int width,
int height)
Returns a scaled elliptical icon from the given image, scaled
within the given width and height.
|
static java.awt.Image |
getScaledEllipticalImage(java.awt.Image image,
int width,
int height)
Creates a elliptical avatar image.
|
static byte[] |
getScaledEllipticalInstanceInBytes(java.awt.Image image,
int width,
int height)
Returns a scaled elliptical instance of the given image.
|
static byte[] |
getScaledInstanceInBytes(java.awt.Image image,
int width,
int height)
Returns a scaled rounded instance of the given image.
|
static javax.swing.ImageIcon |
getScaledRoundedIcon(byte[] imageBytes,
int width,
int height)
Creates a rounded corner scaled image.
|
static javax.swing.ImageIcon |
getScaledRoundedIcon(java.awt.Image image,
int width,
int height)
Returns a scaled rounded icon from the given image, scaled
within the given width and height.
|
static java.awt.Image |
getScaledRoundedImage(java.awt.Image image,
int width,
int height)
Creates a rounded avatar image.
|
static javax.swing.ImageIcon |
scaleIconWithinBounds(java.awt.Image image,
int width,
int height)
Scales the given image to fit in the given width and
height.
|
static javax.swing.ImageIcon |
scaleImageWithinBounds(byte[] imageBytes,
int width,
int height)
Scales the given image to fit in the given width and
height.
|
static java.awt.Image |
scaleImageWithinBounds(java.awt.Image image,
int width,
int height)
Returns a scaled image fitting within the given bounds while keeping the
aspect ratio.
|
static void |
setScaledLabelImage(javax.swing.JLabel label,
byte[] image,
int width,
int height)
Sets the image of the incoming call notification.
|
static byte[] |
toByteArray(java.awt.image.BufferedImage image)
Extracts bytes from image.
|
public static java.awt.Image scaleImageWithinBounds(java.awt.Image image, int width, int height)
image
- the image to scalewidth
- maximum width of the scaled imageheight
- maximum height of the scaled imagepublic static javax.swing.ImageIcon scaleIconWithinBounds(java.awt.Image image, int width, int height)
image
- the image to scalewidth
- the desired widthheight
- the desired heightpublic static javax.swing.ImageIcon scaleImageWithinBounds(byte[] imageBytes, int width, int height)
imageBytes
- the bytes of the image to scalewidth
- the desired widthheight
- the desired heightpublic static java.awt.Image getScaledRoundedImage(java.awt.Image image, int width, int height)
image
- image of the initial avatar image.width
- the desired widthheight
- the desired heightpublic static java.awt.Image getScaledEllipticalImage(java.awt.Image image, int width, int height)
image
- image of the initial avatar image.width
- the desired widthheight
- the desired heightpublic static byte[] getScaledInstanceInBytes(java.awt.Image image, int width, int height)
image
- the image to scalewidth
- the desired widthheight
- the desired heightpublic static byte[] getScaledEllipticalInstanceInBytes(java.awt.Image image, int width, int height)
image
- the image to scalewidth
- the desired widthheight
- the desired heightpublic static javax.swing.ImageIcon getScaledRoundedIcon(java.awt.Image image, int width, int height)
image
- the image to scalewidth
- the maximum width of the scaled iconheight
- the maximum height of the scaled iconpublic static javax.swing.ImageIcon getScaledEllipticalIcon(java.awt.Image image, int width, int height)
image
- the image to scalewidth
- the maximum width of the scaled iconheight
- the maximum height of the scaled iconpublic static javax.swing.ImageIcon getScaledRoundedIcon(byte[] imageBytes, int width, int height)
imageBytes
- The bytes of the image to be scaled.width
- The maximum width of the scaled image.height
- The maximum height of the scaled image.public static javax.swing.ImageIcon getScaledEllipticalIcon(byte[] imageBytes, int width, int height)
imageBytes
- The bytes of the image to be scaled.width
- The maximum width of the scaled image.height
- The maximum height of the scaled image.public static java.awt.image.BufferedImage getBufferedImage(java.net.URL imagePath)
imagePath
- the path indicating, where we can find the image.public static java.awt.image.BufferedImage getBufferedImage(java.awt.Image source)
source
- an imagepublic static byte[] toByteArray(java.awt.image.BufferedImage image)
image
- the image.public static java.awt.Image getBytesInImage(byte[] imageBytes)
imageBytes
- The bytes array to load the image from.public static java.awt.Image getComposedImage(java.awt.Image leftImage, java.awt.Image rightImage, java.awt.image.ImageObserver imageObserver)
leftImage
- the left image.rightImage
- the right imageimageObserver
- need to calculate image sizes.public static void setScaledLabelImage(javax.swing.JLabel label, byte[] image, int width, int height)
label
- the label to set the image toimage
- the image to setwidth
- the desired image widthheight
- the desired image height
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.