public class DownTest {
public static void main(String[] args)throws Exception {
FileInputStream file = new FileInputStream("E:\\20171102_cf36c03d56fbdf6214c3e5d196b90e21.webp");
byte[] bytes = new byte[30];
file.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);
System.out.println(width);
System.out.println(height);
}
}
获取文件头的27 28 位计算得到宽 29 30得到高