java获取图片原始尺寸
URL url = null; InputStream is = null; BufferedImage img = null; try { url = new URL(picurl); is = url.openStream(); img = ImageIO.read(is); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } //System.out.println(img.getHeight()+"/"+img.getWidth()); String str = "{\"width\":\""+img.getWidth()+"\",\"height\":\""+img.getHeight()+"\"}"; out.print(str);
☜☞梦想总是要有的,万一实现了呢☜☞