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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula to find image resolution???

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, like a formula to follow??? (I am able to find the images file size and height and width in pixels after it's been uploaded.) 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 ;)
 
i dont think there is a way to find resolution. [soapbox]
sleep is good
 
Is this for a website? I mean, does the solution need to be part of an html or asp page? If so you might try asking in the java or javascript or html forums.
hope this helps,
sdraper
 
There is no way to find out if an image is 72 dpi or 300 dpi. No amt of php/asp/javascript will be able to determine this.
 
It depends on the file format being uploaded. Some formats do carry this information, so you will need to check out somewhere like to see where to find it (it's usually in the header section of most formats, but it's exact location will vary). It should be possible to write a server side script to detect this value using any technology that lets you read binary data from a file.

Knowing the pixel dimensions isn't enough without knowing the physical dimensions too. 300 pixels, for example, could mean one inch at 300dpi, or three inches at 100dpi. If you do know the physical dimensions, then divide the pixel dimensions by that amount to find the resolution. Just be careful to note what unit of measurement you are using (inches, millimeters, etc).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top