I'm doing steganography on Android. My code is as follows:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.src);
picw = mBitmap.getWidth();
pich = mBitmap.getHeight();
pix= new int[picw * pich];
mBitmap.getPixels(pix, 0, picw, 0, 0, picw, pich);
try {
FileOutputStream fos = super.openFileOutput("dest.png", MODE_WORLD_READABLE);
mBitmap.compress(CompressFormat.PNG, 100, fos);
fos.flush();
fos.close();
}catch (Exception e) {
tv.setText(e.getMessage());
}
My problem is that whenever I save source image with the Bitmap.compress()
method, the pix[0]
value changes during compression, so I'm unable to extract original data. How can I fix this?