How to change Bitmap image color in android?

I tried Josip’s answer but wouldn’t work for me, regardless of whether the offset parameter was 1 or 0 – the drawn bitmap just appeared in original colour. However, this did work: // You have to copy the bitmap as any bitmaps loaded as drawables are immutable Bitmap bm = ImageLoader.getInstance().loadImageSync(“drawable://” + drawableId, o) .copy(Bitmap.Config.ARGB_8888, … Read more

Is there a good way to convert between BitmapSource and Bitmap?

It is possible to do without using unsafe code by using Bitmap.LockBits and copy the pixels from the BitmapSource straight to the Bitmap Bitmap GetBitmap(BitmapSource source) { Bitmap bmp = new Bitmap( source.PixelWidth, source.PixelHeight, PixelFormat.Format32bppPArgb); BitmapData data = bmp.LockBits( new Rectangle(Point.Empty, bmp.Size), ImageLockMode.WriteOnly, PixelFormat.Format32bppPArgb); source.CopyPixels( Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride); bmp.UnlockBits(data); return bmp; }

Bitmap in ImageView with rounded corners

try this one : public class CustomImageView extends ImageView { public static float radius = 18.0f; public CustomImageView(Context context) { super(context); } public CustomImageView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override protected void onDraw(Canvas canvas) { //float radius = 36.0f; Path clipPath … Read more

How to use JNI bitmap operations for helping to avoid OOM when using large images? [closed]

NOTE: this is a bit old code. for the most updated one, check out the project page on github. jni/Android.mk LOCAL_PATH := $(call my-dir) #bitmap operations module include $(CLEAR_VARS) LOCAL_MODULE := JniBitmapOperations LOCAL_SRC_FILES := JniBitmapOperations.cpp LOCAL_LDLIBS := -llog LOCAL_LDFLAGS += -ljnigraphics include $(BUILD_SHARED_LIBRARY) APP_OPTIM := debug LOCAL_CFLAGS := -g #if you need to add more … Read more

How do I fill a bitmap with a solid color?

This should do what you need it to. It will fill the entire bitmap with the specified color. Bitmap Bmp = new Bitmap(width, height); using (Graphics gfx = Graphics.FromImage(Bmp)) using (SolidBrush brush = new SolidBrush(Color.FromArgb(redvalue, greenvalue, bluevalue))) { gfx.FillRectangle(brush, 0, 0, width, height); }

Get Bitmap from ImageView in Android L

If you just want the Bitmap from a ImageView the following code may work for you:- Bitmap bm=((BitmapDrawable)imageView.getDrawable()).getBitmap(); Try having the image in all drawable qualities folders (drawable-hdpi/drawable-ldpi etc.) Could be that the emulator or device your using has a different density and is trying to pull images from another folder. If you are using … Read more