Fading background image from normal image to faded image - android

I am doing a project in which i want to fade my background image from normal to fade the same image so the text over it can be displayed properly...but i am not getting how to do it??

Try putting both images in a TransitionDrawable. This is a type of drawable that is used to cross-fade between its layers when startTransition(int) is called. See the TransitionDrawable documentation here.

Related

Image getting destroyed when being put in drawables folder

I have the following image that I intend to use in a game:
When I use "Add new Image Asset" and add this image as a "Action Bar and Tab Icon"
All the black parts of the image are replaced with white so the image looks like this when it is drawn on the canvas:
Why is the image getting destroyed and how do I fix it?
I thought about putting the image as a "Launcher Icon" but that didn't seem to make sense.
Use Scaletype property in ImageView which helps you to manage the image inside ImageView.

How to modify image appearance in Image View?

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ā€ˇ

How to fill the drawable region in an imageView with another drawable?

so I'm trying to find the region of the current image in the ImageView and fill that region with a different image. Here is the original image Empty Circle inside an imageView. The imageView has a drawable of a circle inside. Then I'm trying to make it into something like this Circle filled with image inside an ImageView when a user chooses an image. I don't want to manually Photoshop a circle image. I am just hoping to fill the region with another image. I have tried SRC_IN method from AlphaComposite, but for android, I can't convert from BitMap to graphics2D. If anyone knows how to solve this using the BitmapFactory in android, I would really appreciate your help. Thank you.
The other solution besides Bitmaps, may be too simple for whatever you are trying to achieve otherwise I think it would have occurred to you. I'm just pointing it out in case you have "code blindness" and are trying to over-engineer the solution because you've worked on it for too long (we've all done it)
It is to have that circle/shape image saved as a png with the area you want filled being transparent then set it as the drawable for an ImageView (etc.) then in a RelativeLayout lay this view over the image you want to fill the area and apply a transparent background to the shape view OR simply set the fill image as the background for the shape view.

How to get black shadow around the image dynamicaly?

I am working on image processing i have achieved color effect using ColorMatrix but i cant understand how to achieved one effect that is not on whole image but only around the image like i have attached image. Actually i m working on image editor app like : BeFunkey
Here original image and processed image i have attached. You can see in effect on second image that is only around the image black shadow. Please can anybody tell me how to do this. Thank you in advance.
You need to set RGB colors of you bitmaps. Have a look over android-image-filter
This demo will fulfill your requirements.

Trying to use transparent image but a black background is being added

I have a transparent image in my drawable folder and I'm trying to send it using an Intent. The image loads and sends just fine but it's no longer transparent and has a black bacground attached to it. This is how I'm sending the image
Intent localIntent = new Intent("android.intent.action.SEND");
localIntent.putExtra(Intent.EXTRA_STREAM,
Uri.parse("android.resource://com.t4t.stickerwhatsapp/" + videoDetails.get(pos)));
localIntent.setType("image/*");
startActivityForResult(localIntent,111);
videoDetails.get(pos) is the id of the image in the drawable folder. Why is it adding a black background to my images?
Edit: It turns out my phone is adding the black bg to all transparent images that I receive it's not the code adding it before it sends.
You should get the drawable out of the resources by using the resources available from getResources().
I recommend you use:
Drawable drawable = getResources().getDrawable(R.drawable.image);
The id of an image may change and keeping tabs on it is a bad idea. If you must do this, instead you may use:
getResources().getIdentifier("image", "drawable","package_name");
If the image is still not transparent, I might try setting the drawables background color using Color.Transparent. It can be a number of issues, especially if on the other end the drawable is getting processed.
It turns out my phone is adding the black bg to all transparent images that I receive it's not the code adding it before it sends.

Categories

Resources