1

android convert a white and black image in drawable to a byte array to print it

view story
linux-howto

http://stackoverflow.com – I have an image in black and white I need to printed using a printer that prints only black color. I need to convert my image to a byte array to print it. I tried this code: Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.test2); Log.v("test", bmp.getHeight() + " " + bmp.getWidth() ); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.PNG, 1, stream); byte[] byteArray = stream.toByteArray();" Then I added the bytes in the top of the frame that this printer use but there's something wrong while I convert my black and white im (HowTos)