I have a bitmap and I just want to show central circle area. How to hide the corner area? Actually, it would be great if I could make any area transparent (e.g. make it a ring)?
Convert the bitmap to a transparent PNG - you can use the free Gimp application. Load your picture in Gimp, select the central circle area, copy, then paste as new image. Should automatically make the area around it transparent. Then just save as a PNG file and use that in your Android app.
UPDATE
Here's an answer I found for defining a color to be transparent: Android bitmap mask color, remove color
Related
App State right now
I am making an app in which i want the background scenery/picture to be visible in the black sketch only and the reset of the part of the image should stay opaque. Right now i have made front Imageview transparent to some value but that is not what i want ,i want to change the opacity of black pixels only.
ImageView frontImageView = findViewById(R.id.image);
Bitmap front = BitmapFactory.decodeResource(getResources(),
R.drawable.front);
front=GrayscaleToBin(front);
front.setHasAlpha(true);
frontImageView.setImageBitmap(front);
imageView.setImageAlpha(150);
i have searched a lot but couldn't find a solution to this problem. Any help is appreciated.
I would recommend to make changes in original image from some other tools such as Paint or Photoshop etc and then load image in app.
Since making changes on current image which you are having will again take some time to load unnecessary.
Better process image in other 3rd party tool and use as it is in app.
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.
In my app I am getting image from URL and showing in an ImageView. I get a circle shape(blue color) image which is in a square(white color) background. I want to show my image just as a circle ..How to remove or hide the extra white color in that image within my app?
Below is the image for reference:
You should first remove the white part of image in an image editor like Photoshop or Gimp. Making background transparent won't work because white part is not background, It's in image.
Alternatively, You can create a round Imageview if you want your square images to be shown as circular (e.g. profile pictures on Google+). There is a working code snippet here for rounded ImageView How to create a circular ImageView in Android?
Alternatively, if you don't want to use this snippet, you can use a library that will make it easy to create rounded ImageViews. see this
https://github.com/vinc3m1/RoundedImageViewā€ˇ
I want to repeat specific rectangular area at centre of png drawable instead of repeating the whole image using
android:tileMode="repeat" . If I 9 patch it will get stretched .any solution ?
Either, offline create a new PNG that only consists of the area you want, or dynamically, create a new Bitmap from the area you want and use this image for a drawable.
I drew up a custom drawable icon in MS paint, but when I load the image it has a white background instead of transparent, how do I fix this?
MS Paint probably saved this without a transparent background. Id recommend using something like GIMP or Paint.NET to create this icon. They are both available free.
You probably need to save it as either a .gif file or a .png file too, as these are compatible with transparency (and Android).
I think you have to use better editor for your purposes, which could make the background of your image transparent. MS Paint has no such possibilities.