Tag Archives: bitmap

5,900 views

Get Bitmap Size Get Free Memory Exception Android

Bitmap size calculation: bmpHeight * bmpWidth For example: Resolution of image 1024×860 = 880 640 pixels If every pixel get 4 byte of memory: 880 640×4= 3 522 560 (3.5MB) Get bitmap size without allocation of memory: BitmapFactory.Options options = … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on Get Bitmap Size Get Free Memory Exception Android
7,284 views

Delete Bitmap Android Example

If some memory leak – problem try release of memory used of a big Bitmap what already not to need; Bitmpap bmp; // not null bmp.recycle(); bmp = null;   final boolean bmpIsRecycled = bmp.isRecycled() // Returns true if this … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged | Comments Off on Delete Bitmap Android Example
2,346 views

How get bitmap dimension without loading Android example

Bitmap Width, Height without memory allocation: BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeResource(getResources(), R.id.myimage, options); // now opts.outWidth and opts.outHeight are the dimension of the // bitmap, even though Bitmap is null int imageHeight = options.outHeight; int imageWidth … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on How get bitmap dimension without loading Android example
4,113 views

Drawable Bitmap get width height Android

Drawable dr = getResources().getDrawable(R.drawable.algebra); int h = dr.getIntrinsicHeight(); int w = dr.getIntrinsicWidth();   Bitmap ball = BitmapFactory.decodeResource(getResources(), R.drawable.algebra); int _nWidth = ball.getWidth(); int _nHeight = ball.getHeight();

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on Drawable Bitmap get width height Android
2,809 views

Snow Text Effects Paint.NET

For some graphics you can use Paint.NET editor. http://www.getpaint.net/ How create Snow Effects on Text by 1 minute show this video:

Posted in Android Examples Code | Tagged | Comments Off on Snow Text Effects Paint.NET
8,185 views

Draw Bitmap with Alpha opacity ratio Android

Bitmap bgr = BitmapFactory.decodeResource(getResources(),R.drawable.background); Paint transparentpaint = new Paint(); transparentpaint.setAlpha(100); // 0 – 255 canvas.drawBitmap(bgr, 0, 0, transparentpaint); public void setAlpha (int a) Since: API Level 1 Helper to setColor(), that only assigns the color’s alpha value, leaving its r,g,b … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on Draw Bitmap with Alpha opacity ratio Android
2,281 views

Delete Canvas – Fill Canvas Android example

Fill the entire canvas with the specified color. @Override public void onDraw(Canvas canvas) { canvas.drawColor(Color.GREEN); }

Posted in Android Examples Code, Bitmap, drawing | Tagged , , | Comments Off on Delete Canvas – Fill Canvas Android example
5,667 views

Get the color of a specific pixel Java Android example

ImputStream is = this.getResources().openRawResource(R.drawable.colors); Bitmap mBitmap2 = BitmapFactory.decodeStream(is);   int w = mBitmap2.getWidth(); int h = mBitmap2.getHeight(); // int x , y have to be smaller as w , h int _color = mBitmap2.getPixel(x, y);

Posted in Android Examples Code, Bitmap, drawing | Tagged , , , | Comments Off on Get the color of a specific pixel Java Android example
16,860 views

Convert Drawable to Bitmap to Drawable

Context context = getApplicationContext(); Drawable drawable = context.getResources().getDrawable(R.drawable.my_image); // convert drawable to bitmap Bitmap bitmap = ((BitmapDrawable)drawable).getBitmap(); // convert bitmap to drawable Drawable d = new BitmapDrawable(bitmap); Android example source code.

Posted in Android Examples Code, Bitmap, drawing | Tagged , , | Comments Off on Convert Drawable to Bitmap to Drawable
18,855 views

Hue saturation, color, colored filtering Bitmap Image Android example

/* Copyright (C) 2011 The Android Open Source Project http://www.apache.org/licenses/LICENSE-2.0 */ public class MainActivity extends Activity { private ImageView imageView; private Button button1; Drawable bitmapOrg; private final int[] mColors = {Color.BLUE, Color.GREEN, Color.RED, Color.LTGRAY, Color.MAGENTA, Color.CYAN, Color.YELLOW, Color.WHITE};   @Override … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , , | Comments Off on Hue saturation, color, colored filtering Bitmap Image Android example