Has anyone seen failures from bitmap.compress() for PNG files?

I have a byte array that holds image data (read from a PNG file). I
have verified that the image can be displayed in an ImageView by
getting a bitmap as follows:

           Bitmap bitmap =  BitmapFactory.decodeByteArray(b, 0,
b.length);

Now, if I do

           bitmap.compress(Bitmap.CompressFormat.PNG, 100,
fileoutputstream)

then the compress method returns me false and the file is not written.
I have a valid fileoutputstream.

If I start out with a JPEG image in the beginning instead of a PNG
then it seems to work fine. It just fails if it is a PNG image.
Initially I thought it was because my PNG file was in Indexed Color
Mode (checked it in Photoshop) but the problem persisted even if I
changed it to RGB Color mode.

Any clue what could be the problem?

If anyone has seen this please update the bug that I filed :
http://code.google.com/p/android/issues/detail?can=2&q=2092&colspec=ID%20Type%20Version%20Security%20Status%20Owner%20Summary&id=2092




--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to