I've got an ImageView
, in its onDraw(canvas)
,
i tried:
canvas.drawBitmap(...);//draw an extremely large background 3264 * 2448 pixels
canvas.drawLine(...);//draw target
My question is, how can I save this canvas into a sth like png? Thanks!
I've got an ImageView
, in its onDraw(canvas)
,
i tried:
canvas.drawBitmap(...);//draw an extremely large background 3264 * 2448 pixels
canvas.drawLine(...);//draw target
My question is, how can I save this canvas into a sth like png? Thanks!
From the question here: Drawing on Canvas and save image
imgView.setDrawingCacheEnabled(true);
Bitmap b = imgView.getDrawingCache();
FileOutputStream fos = null;
try {
fos = new FileOutputStream(getFileName());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
b.compress(CompressFormat.PNG, 95, fos);
You can save the view cache image to the disk as png.