android steganography

a 夏天 提交于 2019-12-13 05:15:56

问题


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.



来源:https://stackoverflow.com/questions/4644683/android-steganography

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!