站在巨人的肩膀上 private final int MAX_PIC_LENGTH = 200000;// 最大字节长度限制[可调,最好不要超过200000] private final int SAMPLE_SIZE = 14;// 裁剪图片比列(1/14)[可调] /** * 获取网络图片 */ private Bitmap getHttpBitmap(Strin
public static Map getImageWH(byte[] bytes ){
Map map = new HashMap();
if(bytes==null){
map.put("w", 0);
map.put("h", 0);
return map;
}
try{
ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
BufferedImage bi = ImageIO.read(stream);
int srcWidth = bi.getWidth(); // 源图宽度
int srcHeight = bi.getHeight(); // 源图高度
map.put("w", srcWidth);
map.put("h", srcHeight);
}catch(Exception ex){
logger.error("getImageWH get image w and h has error!");
ex.printStackTrace();
map.put("w", 0);
map.put("h", 0);
return map;
}
return map;
}