类 ImageUtil


  • public class ImageUtil
    extends Object
    图片工具
    作者:
    frankcl
    • 构造器详细资料

      • ImageUtil

        public ImageUtil()
    • 方法详细资料

      • isAnimatedImage

        public static boolean isAnimatedImage​(byte[] byteArray)
        判断是否为动画图片 判断标准:1. 图片格式为GIF 2. 包含多张图片
        参数:
        byteArray - 图片内容
        返回:
        如果为动画图片返回true,否则返回false
      • getImageMeta

        public static ImageMeta getImageMeta​(byte[] byteArray)
        获取图片信息
        参数:
        byteArray - 图片数据
        返回:
        如果成功返回图片信息,否则返回null
      • gray

        public static void gray​(BufferedImage image)
        灰度图片
        参数:
        image - 图片信息
      • resize

        public static BufferedImage resize​(BufferedImage image,
                                           int width,
                                           int height,
                                           int imageType)
        缩放图片
        参数:
        image - 图片信息
        width - 缩放后宽度
        height - 缩放后高度
        imageType - 缩放后图片类型
        返回:
        缩放后图片信息
      • read

        public static BufferedImage read​(byte[] byteArray)
        读取图片
        参数:
        byteArray - 图片内容
        返回:
        如果成功返回BufferedImage实例,否则返回null