I have a code in which the user draws something on the screen, and I want to save it as a PNG in byte []. However, the compress () method returns false. Any idea why this is so? Is there a better way to get byte []?
Bitmap bm = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ALPHA_8); Canvas c = new Canvas(bm); c.drawPath(mSignaturePath, mSignaturePaint); ByteArrayOutputStream out = new ByteArrayOutputStream(); if (bm.compress(Bitmap.CompressFormat.PNG, 100, out)) { byte[] result = out.toByteArray();
Thanks in advance.
source share