-->

android steganography

2019-08-27 01:34发布

问题:

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?

回答1:

This is because of alpha premultiplication that android phones are using to get better performance with PNG images. I was trying a few months ago to create a workaround but unsuccessfully. As far as I know there is no solution for this type of steganography on android so far.

If you want to create better and more robust steganography for android use JPEG images with combination of libjpeg library and NDK. Also there is libraries for using wavelet in images which works too.