标签:read nbsp imageio buffered com 远程 eth put static
package com.haiyisoft.hyoaPc;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import javax.imageio.ImageIO;
public class ReturnImgWH {
/**
* 获取网络图片的宽和高
* @param url
* @return
*/
public static String getWidthAndHeight(String url) {
try {
InputStream is = new URL(url).openStream();
BufferedImage sourceImg = ImageIO.read(is);
int width = sourceImg.getWidth();
int height = sourceImg.getHeight();
return width+"*"+height;
} catch (IOException e) {
}
return "";
}
public static void main(String[] args) {
ReturnImgWH returnImgWH = new ReturnImgWH();
String ss=returnImgWH.getWidthAndHeight("http://172.20.188.232:8017/generic/web/upload/1563446854899.png");
System.out.println(ss);
}
}
标签:read nbsp imageio buffered com 远程 eth put static
原文地址:https://www.cnblogs.com/zhangzhiqin/p/11899644.html