You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
495 B
Java
19 lines
495 B
Java
Finding Width and Height of an Image
|
|
|
|
import java.awt.*;
|
|
import javax.swing.*;
|
|
|
|
public class ImageXY
|
|
{
|
|
public static void main(String[] args)
|
|
{
|
|
|
|
Image image = Toolkit.getDefaultToolkit().getImage("test.jpg");
|
|
ImageIcon icon = new ImageIcon(image);
|
|
int height = icon.getIconHeight();
|
|
int width = icon.getIconWidth();
|
|
System.out.println("height"+height);
|
|
System.out.println("width"+width);
|
|
}
|
|
}
|