 <p>I have modified little bit your <code>encodeIcon()</code>. Now its working fine. it is having the actual image</p> <pre><code>public static void encodeIcon(Drawable icon){ String appIcon64 = new String(); Drawable ic = icon; if(ic !=null){ ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); // bitmap.compress(CompressFormat.PNG, 0, outputStream); BitmapDrawable bitDw = ((BitmapDrawable) ic); Bitmap bitmap = bitDw.getBitmap(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream); byte[] bitmapByte = stream.toByteArray(); bitmapByte = Base64.encode(bitmapByte,Base64.DEFAULT); System.out.println("..length of image..."+bitmapByte.length); } } </code></pre> <p>Thanks Deepak</p>