You can store your bitmap as a palette-based PNG with 2 colors. As far as I know the PNG format allows lossless run-length encoding compression.
If you really want to implement your own data format then the simplest approach would be a file header with image width and height, 6 bytes for the two RGB color definitions for your two colors, followed by a sequence of pixel bytes. Each byte encodes 8 sequential pixels from your bitmap where a set bit represents one color and an unset bit the other. If you want to go fancy you could RLE-encode the sequence of pixels but then you might as well store the image as a palette-based PNG. On Sunday, December 30, 2012 8:04:33 AM UTC-6, AndroidCompile wrote: > > Hi, > Can anyone recommend a way to compress a 2 color Bitmap? (preferably a > lossless one) > > I suppose I should use RGB_565 (I am currently using ARGB) , but other > than that, what should give me the best compression ratio? (JPEG, PNG,...) > Should I think of my own compression algorithm for this? > > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

