In my android application I downloaded some png image and write them in sd card. when I show them in image view they are showing with black background. the original images have transparent background. How I can keep the background transparent. Please help me. I use PNG format to compress and write it to sd card
Set The View Background as
R.color.transparent
or in xml like
android:background="#android:color/transparent"
Edited :
Thanks for reply. yes I did this. I did just now One more thing, I set canvas color android.R.color.transparent and it worked
Related
I tried everything, but it didn't work. Please help me
All you have to do it to download a transparent img of a cart and adjust the width and length you can also download it with the link below 👇👇
https://www.flaticon.com/free-icon/shopping-cart_833314?term=cart&page=1&position=3&page=1&position=3&related_id=833314&origin=search
If you have taken this image from your storage then you can simply convert it's background transparent by using any background remover tool online such as this one:
remove background
How can I remove white background around image when loading with glide.. You can find out below code as well as screenshot;
Glide.with(thiscontext).load(R.drawable.badge_green_yellow)
.asGif().crossFade()
.diskCacheStrategy(DiskCacheStrategy.SOURCE).into(holder.ivHourlyIcon);
ScreenShot
Put your GIF into the raw folder (res/raw/badge_green_yellow.gif)
and then load it like this
Glide.with(thiscontext).asGif().load(R.raw.badge_green_yellow).into(holder.ivHourlyIcon);
I have a png image , when I run my android application then the white background of the image is shown ! How to make the image's background transparent ? Here is the captured photo :
Use Photoshop. Use the magic wand to choose the white pixels, then use del key on the keyboard. After that, save it and re import it to the project.
i stuck in very serious problem.when i am downloading png image from server than, i can get black background in the image. how can i remove this black background from an image at the time of downloading?
Thanks in advance.
Image change extension .png while you download image then change background color pixel by pixel cut on image and return new bitmap
Do you save your image on the device using PNG format too ?
I use the following statement to copy an image from the assets to the gallery app, which works fine:
MediaStore.Images.Media.insertImage(getContentResolver(), myBitmap, myTitle , myDescription);
The images are png-files with a transparent background. They are displayed correctly when I load them from the assets to, for example an ImageView.
The problem is, that the formerly transparent background of the imported images became solid black in the gallery.
The png is a png24 created by gimp. I also tried a transparent gif and a png with transparency added by Apple's preview application with the same result.
Why it happens?
I know this is an old question but I just had the same problem. The problem is that MediaStore.Images.Media.insertImage stores the file with a MIME_TYPE of "image/jpeg", and jpeg doesn't support transparency.
One solution is to make your own content provider that uses another image format. The Picasso image library might be worth a look too.