Can you call Bitmap.compress() and just stored the resulting png-stream in your file?
On Wed, Jan 14, 2009 at 9:37 PM, Patrick <bpatm...@gmail.com> wrote: > > Ok, I have to post again, because what appears to have worked before > only did if the alpha channel of the bitmap was mostly opaque. > > All I need is to save and load a bitmap inside a file of my own > format. I don't really care what format the bitmap data itself has, as > long as 100% of the data in the bitmap is restored on load, including > the alpha channel. I have now spent several days trying to achieve > what should be a very simple thing. > > Bitmap.getPixels clearly does not return the raw bitmap data, at least > not for an 8888 format. The color channels are modified based on the > alpha in some way. Bitmap.copyPixelsToBuffer seems to return better > results, but there is no equivalent Bitmap.copyPixelsFromBuffer to > restore the bitmap on load, and using Bitmap.setPixels to restore > gives a blueish tint. > > I thought of playing some trick where I would get the pixels, copy out > the alpha component to my own storage, set the alpha to 0xFF > everywhere on the bitmap, and then read the color out. But that > doesn't seem to work either. The color channels are different, but > still not correct. Pixels with a low alpha value are darker then what > they should be. A pixel that was set to 20% opaque white comes back as > 20% opaque blackish. > > I am really at a loss as to what I can possibly do to properly extract > and restore the exact state of a bitmap. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---