GetPixel on image view bitmap

ukimiku

Active Member
Licensed User
Longtime User
I am sure I am missing something basic, but can't figure it out: I want to get the color of a pixel from an imageview (called "iv") bitmap:

B4X:
iv.Bitmap = LoadBitmap(File.DirAssets, "t.gif")
dim c as int
c = iv.Bitmap.GetPixel(2,3)

But I am told GetPixel was not amongst the Bitmap members. When I look up "Bitmap", the documentation tells me that GetPixel is a member of a Bitmap object.

Thank you.

Regards,
 

Informatix

Expert
Licensed User
Longtime User

This should work:
B4X:
iv.Bitmap = LoadBitmap(File.DirAssets, "t.gif")
dim c as int
Dim b as Bitmap
b = iv.Bitmap
c = b.GetPixel(2,3)
 
Upvote 0

ukimiku

Active Member
Licensed User
Longtime User
It does work, yes, thank you. Do you know why I can't access the Bitmap in the imageview directly? It is a bitmap, right? So I think it should expose its members.

Regards,
 
Upvote 0

ukimiku

Active Member
Licensed User
Longtime User
I see, thanks. My understanding is reassured.

Regards,
 
Upvote 0

KingEdem

Member
Licensed User
Longtime User
This is a small bug. ImageView.Bitmap returns the native bitmap and not the wrapped bitmap. You can see in the help popup that it returns android.graphic.Bitmap instead of Bitmap.

Erel,

How can I find the pixel color of zoomed imageview1.bitmap?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…