How to get the width of an image that has been scaled

enter image description here

  • Actual image source height = 180 pixels and width = 192 pixels
  • ImageView has a width of 90 pixels and 60 pixels.

I want to know the actual height and width of the image as shown on the screen. Can someone help me?

I tried the following, but it did not give me the results I was looking for

  • If I do imageview.getWidth, I get 90px ImageView
  • If I do imageView.getMeasuredWidth, I get 90px ImageView
  • if I do imageview.getDrawable.getIntrinsicWidth, I get the actual source width of 192px
  • if I do imageview.getDrawable.getBounds, I get the actual width of the source 192px
  • If I get a bitmap and get getScaledWidth (metrics), I get the actual source width of 192px
+5
1

- :

  • (IH) (IW)
  • ImageView (H).
  • (TP) (BP) ImageView
  • DIH = H - (BP + TP)
  • DIW = (IW * DIH)/IW;

, .

+1

All Articles