问题
I'm trying to implement steganography on Android...but the bitmap gets compressed when it's stored, and that changes the pixel values. Is there any other way to store the image?
Thanks in advance!!
回答1:
You should use a lossless compression method for your application since common compression methods with losses such as JPG will ruin your watermark data as you have checked. Taking a look at Bitmap Compression formats it seems that only JPG and PNG compression formats are available. AFAIK png is a lossless compression method so you could use it to save your data.
回答2:
FileOutputStream fos = new FileOutputStream(filename);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
Try passing 100 as maximum value of compress quality, in this way you will compress the bmp loosless.
来源:https://stackoverflow.com/questions/4639430/android-steganography