I am trying to retrieve a bitmap
and save to my local disk on PC.
As a result I get a jpeg file (95 bytes) which cannot be read.
source:
Application application = new MyApplication();
Bitmap bitmap = BitmapFactory.decodeResource(application.getResources(), drawableId);
File outputFile = new File("D:\\OutputFile.jpg");
OutputStream os = new FileOutputStream(outputFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, os);
IoUtils.closeSilently(os); //close stream
P.S. I know that I can't get bitmap
from drawable
. But I don't know why...