1. Open the root directory under Test.jpg
Bitmap BM = Bitmapfactory.decodefile (Environment.getexternalstoragedirectory (). GetAbsolutePath () + "/test.jpg");
int[] pixels = new Int[bm.getwidth () *bm.getheight ()];
Bm.getpixels = (Pixels,0,bm.getwidth (), 0,0,bm.getwidth (), Bm.getheight ());
Bitmap bm1 = bm.copy (Bm.getconfig (), true),//BM is not Mutable, pixel value cannot be changed
Bm1.setpixels (Pixels,0,bm.getwidth (), 0,0,bm.getwidth (), Bm.getheight ());
Savebitmap ("Test2", BM1);
Imagevie Imgview = (ImageView) Findviewbyid (R.ID.IMAGEVIEW1);
Imgview.setimagebitmap (BM1);
2. Save the picture
public void Savebitmap (String name,bitmap mbitmap) {
File File = new file (Environment.getexternalstoragedirectory (). GetAbsolutePath () + "/" +name+ ". png");
File.createnewfile ();
FileOutputStream fout = null;
Fout = new FileOutputStream (file);
Mbitmap.compress (bitmap.compressformat.png,100,fout);
Fout.flush ();
Fout.close ();
}
Android Open, save picture to SD card, show picture