Issue
I'm displaying an image using the technique in this question, but using 100dvb and 100dvi to limit the image to fit the screen.
How do I calculate what scale factor was used? I don't know the original size of the image, or the size of the screen, but I can obtain the latter. I was hoping this question would help figure the scale factor, but I get the same results for offsetWidth/Height and getBoundingClientRect, which are the size after scaling.
If I could obtain the original image size, I could obviously calculate the scale factor. If I could obtain the scale factor, I could calculate (at least within a few pixels) the original image size. I'm most interested in getting or calculating the scale factor.
Solution
Found the answer in this question, about the same time that Kokodoko supplied it in comments. naturalWidth and naturalHeight give the original dimensions of the image.
Answered By - Victoria
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.