given original image resolution, how to calculate new resolution using javascript, after scaling it?

I have an image fetched from the server and I know how to get the image's resolution from the server (using ImageMagick resolution). So this resolution is the image DPI from imageMagick.

When the user uploads an image, I tell the user what the image's resolution is, and they can now play around with the image and scale it. Now when an image gets scaled, resolution naturally changes. So if I have a 300dpi image and the user scales it bigger, the resolution gets less. If he scales it smaller, the resolution increases. Whatever he does, when he's finished with the image, I have to tell him the new resolution.

Is there any javascript library or any client-side way to determine the new resolution after scaling? Or is the best solution simply ajax again - to send the image back to the server and get the new resolution? I want to avoid this for purposes of speed.

Answers:

Answer

This turned out to be the kind of calculation I was looking for, albeit in Flex:

http://blog.mediarain.com/2009/09/calculating-image-resolutions-in-flex/

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.