0

I have been trying to save a bitmap as grayscale. The configurations provided by android to store single channel color seems to be only ALPHA_8. When trying to save bitmap in ALPHA_8 as JPEG by calling Bitmap.compress function, I get blank image. What is the correct way of saving grayscale image in android?

Please note that my concern is about storage requirement. I just want to save a single channel(grayscale) JPEG. Making R==G==B in ARGB_888format does make it grayscale but the color information saved by Bitmap.compress still seems to be 3 channel.

Yadav Dhakal
  • 87
  • 1
  • 6
  • ALPHA_8 stores the data as a transparency channel, useful for some effects. It's not meant for grayscale. You still want to use ARGB_8888, you just want to make sure that R==G==B for each byte so its gray – Gabe Sechan Sep 14 '22 at 14:50
  • My primary concern here is storage requirement. When saving using Bitmap.compress, what ensures that it is saved as only single channel? Setting R == G == B, does make it gray but does it save as single channel as well? – Yadav Dhakal Sep 14 '22 at 14:59

0 Answers0