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.
This turned out to be the kind of calculation I was looking for, albeit in Flex:
©2020 All rights reserved.