Black background when downloading png image in android - android

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 ?

Related

Remove transparent white background from gif image using glide?

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);

How to remove this png image's white background?

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.

How to use same Android drawable to all resolutios

I have one big image named panel_bck.jpg to use in different resolutions to decrease apk size. The image format is JPG and it's size is 1.9MB. I put it to default drawable folder only. But when I set the background in code, the BitmapFactory can't find the image at
drawable/panel_bck.jpg
and the result is all black background. I tested this case with other images(PNG files, JPG files) and there is no problem with them. Only question is that a limitation exist for the drawable size or what is the problem? How can I solve this?
If your image very big resoulation you will set drawable-xxhdpi directory only.
I had a problem like yours trying to maka a big image fit into a too small ImageView and I fixed my problem by using this line in the layout xml file:
android:adjustViewBounds="true"
I don't know if it can ba applied to an activity background though.
You should use 9patch image. You can create 9patch image by using the tool called draw9patch located in sdk/tools. First create a large resolution image and give to draw9patch it will create a 9patch image with extension .9.png add that image in drawable it will solve you problem.
See following links for detail
http://developer.android.com/tools/help/draw9patch.html
http://codesignature.com/how-to-design-9-patch-buttons-for-android-using-adobe-photoshop-for-all-pixel-densities-and-states/

downloaded png image with transparent background shows with black background

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

How to persist background transparency while converting image from png to jpg android?

While converting image from png to jpg losing background transparency of png image.How to persist image background in android programmatically?
bmp.compress(CompressFormat.JPEG, 100,fos);
Android developer
The JPEG image format doesn't support transparency on backgrounds.

Categories

Resources