public class ImageUtil extends Object
| Constructor and Description |
|---|
ImageUtil() |
| Modifier and Type | Method and Description |
|---|---|
static BufferedImage |
read(File input)
读取图片
|
static BufferedImage |
read(InputStream input)
读取图片
|
static BufferedImage |
read(String url)
读取图片,http 或者 file 地址
|
static BufferedImage |
read(URL url)
读取图片
|
static boolean |
write(RenderedImage im,
String formatName,
File output)
写出图片
|
static boolean |
write(RenderedImage im,
String formatName,
ImageOutputStream output)
写出图片
|
static boolean |
write(RenderedImage im,
String formatName,
OutputStream output)
写出图片
|
static byte[] |
writeAsBytes(RenderedImage im,
String formatName)
写出图片为 byte 数组
|
static ByteArrayInputStream |
writeAsStream(RenderedImage im,
String formatName)
写出图片为 InputStream
|
public static BufferedImage read(File input)
input - 图片文件public static BufferedImage read(InputStream input)
input - 图片文件流public static BufferedImage read(String url)
url - 图片链接地址public static BufferedImage read(URL url)
url - 图片链接地址public static boolean write(RenderedImage im, String formatName, ImageOutputStream output)
im - RenderedImage to be written.formatName - a String containing the informal name of the format.output - an ImageOutputStream to be written to.public static boolean write(RenderedImage im, String formatName, File output)
im - RenderedImage to be written.formatName - a String containing the informal name of the format.output - an ImageOutputStream to be written to.public static boolean write(RenderedImage im, String formatName, OutputStream output)
im - RenderedImage to be written.formatName - a String containing the informal name of the format.output - an ImageOutputStream to be written to.public static byte[] writeAsBytes(RenderedImage im, String formatName)
im - RenderedImage to be written.formatName - a String containing the informal name of the format.public static ByteArrayInputStream writeAsStream(RenderedImage im, String formatName)
im - RenderedImage to be written.formatName - a String containing the informal name of the format.Copyright © 2024. All rights reserved.