how to get image dimension

Hi ,

I need to find the height and width of an image (any type. for eg.jpg,png,tif,gif,eps etc.)

the following code works for jpg,png and gif but not for eps and tif.

eps is what i need. I read that imageicon does support jpg,png and gif and not other types. so is there any solution to find the dimesion of image files with eps and tif extension.

ImageIcon ic =new ImageIcon ("filename");

out.println(" height = " + ic.getIconHeight());

out.println(" width = " + ic.getIconWidth());

thanks,

Thanuja.

[665 byte] By [thanua] at [2007-11-27 11:33:47]
# 1

You may find the ImageRo API useful:

http://reader.imagero.com

BalusCa at 2007-7-29 16:53:27 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

hey thanks. it supports eps also. It returns image width and height in pixels. but i need it in cm or picca. i tried searching the imagero package but i could not get. If i convert the pixels to cm then it will differ for differenct screens. do u have any idea?

Thanks,

Thanuja.

thanua at 2007-7-29 16:53:27 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Like you said, it will differ per screen.

Why do you need cm's anyway? Pixels are widely known and accepted as the standard format for digital images.

BalusCa at 2007-7-29 16:53:27 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

ya but i have a requirement to get it in cm or picca. is it possible to get the image resolution? so that i can convert it to cm

Thanks

thanua at 2007-7-29 16:53:27 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

The image resolution is the image dimensions in pixels.

You can convert it to centimeters, but it will differ per presentation. It differs per screen and printer how many pixels it can put in one cm.

BalusCa at 2007-7-29 16:53:27 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

ya exactly. iam sorry.

is it possible to get the image width and height in cm using imagepro.

tutorial in their site is not working. do u have any link which explains imagepro tutorial

thanua at 2007-7-29 16:53:27 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

The tutorial link points to a forum with a heap of topics containing code snippets.

https://customssl.com/forum.imagero.com/viewforum.php?f=11

BalusCa at 2007-7-29 16:53:27 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8

i tried a lot but could not get the dimension in cm rather than pixel. any help?

thanua at 2007-7-29 16:53:27 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9

BaluC any idea?

thanua at 2007-7-29 16:53:27 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...