java读取图片长宽问题
参考
public int getPicWidthOrHeight(String photo, String flag) {try {File _file = new File(photo);Image src = javax.imageio.ImageIO.read(_file);int wideth = src.getWidth(null);int height = src.getHeight(null);if("W".equalsIgnoreCase(flag)){return wideth;}else{return height;}} catch (Exception e) {// TODO: handle exceptionreturn 0;}}