Bitmap color change while compressing to png

后端 未结 2 1263
無奈伤痛
無奈伤痛 2021-01-14 04:09

I\'m currently working on a steganogrpahy android app as a class project. I\'ve created an object that will encode an image with in another image and return an encoded bitma

2条回答
  •  礼貌的吻别
    2021-01-14 04:42

    For anyone who stumbles upon it, like me, wondering why bitnap colors change once you write it out in PNG. I have found out that using bitmap.setPreMultiplied(false) before calling bitmap.compress(PNG, 100, fileout) preserves the color of your image if it has alpha channel values. Setpremultiplied prevents the pixels written onto disk from being multiplied by alpha channel, thus generating different pixel color values.

提交回复
热议问题