Android Question Image without borders

nibbo

Active Member
Licensed User
Longtime User
Easy one today.
Is there a way to switch off the borders on an image view?
There does not seem to be a border property that I can see.
I have tried changing the colour property, adding a colourdrawable background but still it looks the same.
Even tried to make it a background on a label but that all seem to put the border left and top.

Thanks
 

Johan Schoeman

Expert
Licensed User
Longtime User
Make the border color transparent...?
https://www.b4x.com/android/forum/threads/roundbitmapwithborder-inline-java-code.51848/#post-380801
 
Upvote 0

nibbo

Active Member
Licensed User
Longtime User
Thanks for the replies Johan but this just seems to add a second border to the picture.
Using LoadBitmap; LoadBitmapSample & vbBitMap.LoadBitmap all add a border;
calling addSquareBorder adds an additional border outside of the original one so not the effect I was after.

Thanks anyway, some interesting stuff in those examples.
 
Upvote 0

nibbo

Active Member
Licensed User
Longtime User
No wait... I have just done a quick test project which loads a image view onto a panel and there are no borders.
Now I am confused, why in one project do I have borders and not in the other?

I will post back how stupid I have been when I find out...
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Using thé same image? Are you sure your image has no borders?
 
Upvote 0

nibbo

Active Member
Licensed User
Longtime User
Using thé same image? Are you sure your image has no borders?
Hi Cable guy,
Thanks for your time, your post did lead my investigation in a different direction which has helped immensely.
In one app I added the images to the project and it displays fine.
The other app downloads them from a server and saves them locally (File.DirInternal).
It was hard to tell if it was the downloaded image due to android storing stuff where you cant see it via file mangers.
I changed the download to save them in File.DirRootExternal so I could see them and to my amazement they do now have a border.

The plot thickens...
 
Upvote 0

nibbo

Active Member
Licensed User
Longtime User
OK, narrowed it down a bit further.
If I set the image view to a manually copied version of the image - no border.
If I set the image view to a downloaded image straight from the httpjob.GetBitmap - no border.
If I save the image to the tablet and then set the image using LoadBitmap - now we have a BORDER?

Further messing about revealed that changing the format in the WriteToStream operation from JPEG to PNG (even thought the files are .jpg) NO border?

All solved but if anyone has an explanation I would love to know it.

Thanks for your help as always.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Can it be that the image has a small transparent gradient towards the borders and that when saved as PNG it keeps the transparency?
Have you checked the original vs copied file for size differences?
 
Upvote 0

nibbo

Active Member
Licensed User
Longtime User
Can it be that the image has a small transparent gradient towards the borders and that when saved as PNG it keeps the transparency?
Have you checked the original vs copied file for size differences?

I think that is it. If I open one using an image editor there is a very narrow (2 pixel top and left, 1pixel bottom and right) border.
The save in PNG format must keep that intact but the JPEG format must replace it with a dark colour.

Thanks Cableguy - mystery solved.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…