Android Question GetPixel from Zoomed Image

KingEdem

Member
Licensed User
Longtime User
This is a community forum. Please do not limit your questions to a single member.

B4X:
Dim bmp As Bitmap = ImageView1.Bitmap
Log(bmp.GetPixel(10, 10))


This gives the pixel value of non scaled image.

I am changing the width and height of imageview1 and trying to get the pixel value from a zoomed imageview1. Let me know how I can get the value from scaled/zoomed imageview1.bitmap.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
what's the difference?

just calculate the pixel position based on the zoomed left/top offsets.
 
Upvote 0

KingEdem

Member
Licensed User
Longtime User
what's the difference?

just calculate the pixel position based on the zoomed left/top offsets.

I am changing the following property of imageview1:
Width
Height
Top
Left.

It becomes complicated to correlate the actual pixel.
 
Upvote 0

James Chamblin

Active Member
Licensed User
Longtime User
BitMapX = bmp.Width/imv.width * ImageViewX
BitMapY = bmp.Height/imv.Height * ImageViewY

bmp is the bitmap
imv is the imageview
ImageViewX,ImageViewY is the X,Y coordinate of the imageviuew you wish to sample
BitMapX, BitMapY is the X,Y coordinate of the BitMap to sample.
 
Upvote 0
Top