Skip to content

Instantly share code, notes, and snippets.

@laaptu
Created June 12, 2014 09:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laaptu/d17d9f921f264c087508 to your computer and use it in GitHub Desktop.
Save laaptu/d17d9f921f264c087508 to your computer and use it in GitHub Desktop.
Convert Bitmap to InputStream
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(CompressFormat.PNG, 0 /*ignored for PNG*/, bos);
byte[] bitmapdata = bos.toByteArray();
ByteArrayInputStream bs = new ByteArrayInputStream(bitmapdata);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment