Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Possible to find image resolution??? 1

Status
Not open for further replies.

colep

Programmer
Jul 18, 2002
58
US
I am trying to find the resolution of an image that the user uploads. And if isn't a high enough resolution, I need to inform the user that the image was rejected. Is there any way to determine what the resolution is??? I haven't been able to find any information to help me with this and I'm hoping that someone has come across this problem before and can help me out. Thanks in advance for your help!!!!!

Frustrated,
Cole ;)
 
Images don't have a resolution. Images have a height and a width.

If that's what you're looking for, I recommend you take a look at the function getimagesize() (
Caveat: getimagesize() is only available if you have the GD library installed and PHP compiled to use it. Want the best answers? Ask the best questions: TANSTAAFL!
 
Acually, they do. When you go to save an image in Photoshop, you have the option of saving the image at a higher resolution which is then a larger file size. The resolution is determined by how many pixels are in each inch of the image. There has to be a way to get this value with the images dimensions and file size.
I am creating a program for a photo company which will allow the end user to upload their digital image so it can then be downloaded and made into actual prints. And this image has to be at a certain resolution in order for the prints to turn out. That is why I need to find the images resolution....
If anyone out there has somewhere I can go to better research this or if someone has come across this, please point me in the right direction. I know that this can be done, because there are websites out there that check for this....

Thanks,
Cole ;)
 
An image file contains pixels. It is the output medium (display, print) that maps image pixels to output pixels. In your particular case, Photoshop can arbitrarily change the image-to-display pixel mapping. It can also completely rewrite the image on the fly to better make use of the image by resizing it. But I don't have to tell you that an image can only be resized so far in either direction (larger, smaller) before image quality degrades.

Open an image in your web browser. Just the image, with no HTML surrounding it. Measure the physical space the image takes in your display. Then change the resolution of your screen and redisplay the image.

If the image does not change size, then the image would have to have resolution information in it. If the physical size of the image does change, however, then it is the display metaphor which imposes a resolution on the image, and the image merely has pixel dimensions.

Now you may be using some less-common image format, where the image file contains some preferred resolution information. But the commonly-used ones on the web (JPEG, PNG, GIF) contain information that tells a renderer that the image file represents a number of pixels horizontally and vertically. They do not constrain the number of pixels per inch, because those image file formats cannot possibly contain sufficient information to tell a renderer to remap image-to-display pixels for every output medium.

But you don't have to take my word for it. The file formats for JPEG, PNG, and GIF are all readily available on the internet. In all three cases, you will find that the format contains information for the dimensions of the pixel grid, and nothing about resolution. Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top