Package com.github.ngoanh2n
Class ImageUtils
java.lang.Object
com.github.ngoanh2n.ImageUtils
- Since:
- 2021
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImage
Create a newBufferedImage
.static BufferedImage
create
(BufferedImage image) Create a newBufferedImage
.static BufferedImage
create
(BufferedImage image, Dimension size) Create a newBufferedImage
.static BufferedImage
crop
(BufferedImage image, Rectangle rect) Crop a new sub image from source image by a rectangle.static void
drawArea
(BufferedImage image, BufferedImage area, Point location) Draw a sub image over source image at specific location.static void
fill
(BufferedImage image, Color color) Fill color over image.static File
save
(BufferedImage image, File output) Save image to output.
-
Constructor Details
-
ImageUtils
public ImageUtils()
-
-
Method Details
-
create
Create a newBufferedImage
.- Parameters:
size
- The dimension for newBufferedImage
.- Returns:
- The
BufferedImage
.
-
create
Create a newBufferedImage
.- Parameters:
image
- The original image to fill over newBufferedImage
.- Returns:
- The
BufferedImage
.
-
create
Create a newBufferedImage
.- Parameters:
image
- The source image to fill over newBufferedImage
.size
- The dimension for newBufferedImage
.- Returns:
- The
BufferedImage
.
-
fill
Fill color over image.- Parameters:
image
- The image to be colored.color
- The color to fill over image.
-
crop
Crop a new sub image from source image by a rectangle.- Parameters:
image
- The image to be cropped.rect
- The bounding rectangle against source image.- Returns:
- The new
BufferedImage
after cropped.
-
drawArea
Draw a sub image over source image at specific location.- Parameters:
image
- The source image to be drawed.area
- The sub image to draw over source image.location
- The specific location as starting point.
-
save
Save image to output.- Parameters:
image
- The image to be saved.output
- The location to store.- Returns:
- The saved location as
File
.
-