---
title: "java获取图片的宽度高度"
author: "zhou_wu"
date: "2011-11-29T15:25:15Z"
tags: []
categories: ["编程语言"]
slug: "java"
draft: false
lastmod: "2011-11-29T15:25:15Z"
id: 1284034
url: "https://leesmart.iteye.com/blog/1284034"
---

```java

import javax.swing.ImageIcon;
String path = getImagePath(request);
ImageIcon   icon=new         ImageIcon(  request.getRealPath("/images/"+path));
int   iWidth=icon.getIconWidth();
int   iHeight=icon.getIconHeight();
}
```