我在 Android 上做隐写术。我的代码如下:
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());
}
我的问题是,每当我使用该Bitmap.compress()
方法保存源图像时,pix[0]
压缩过程中值会发生变化,因此我无法提取原始数据。我怎样才能解决这个问题?