栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

java解析webp格式图片宽高;java解析webp图片转png格式

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

java解析webp格式图片宽高;java解析webp图片转png格式

java解析webp格式图片宽高;java解析webp图片转png格式

package 你的包名:***.***.***.***;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;


public class ImageUtils {

    
    public static ImageBean webpToPng(InputStream inputStream) throws IOException {
        byte[] bytes = new byte[30];
        inputStream.read(bytes, 0, bytes.length);
        int width = ((int) bytes[27] & 0xff) << 8 | ((int) bytes[26] & 0xff);
        int height = ((int) bytes[29] & 0xff) << 8 | ((int) bytes[28] & 0xff);
        ImageBean imageBean = new ImageBean();
        imageBean.setWidth(width);
        imageBean.setHeight(height);
        return imageBean;
    }

    
    public static class ImageBean {

        private Integer width;      //宽度
        private Integer height;     //高度

        public Integer getWidth() {
            return width;
        }

        public void setWidth(Integer width) {
            this.width = width;
        }

        public Integer getHeight() {
            return height;
        }

        public void setHeight(Integer height) {
            this.height = height;
        }
    }

}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/459776.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号