PRivate void saveCroppedImage(Bitmap bmp) { File file = new File("/sdcard/myFolder"); if (!file.exists()) file.mkdir(); file = new File("/sdcard/temp.jpg".trim()); String fileName = file.getName(); String mName = fileName.substring(0, fileName.lastIndexOf(".")); String sName = fileName.substring(fileName.lastIndexOf(".")); // /sdcard/myFolder/temp_cropped.jpg String newFilePath = "/sdcard/myFolder" + "/" + mName + "_cropped" + sName; file = new File(newFilePath); try { file.createNewFile(); FileOutputStream fos = new FileOutputStream(file); bmp.compress(CompressFormat.JPEG, 50, fos); fos.flush(); fos.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
bitmap图片的保存,bitmap图片加水印后,保存在本地文件
新闻热点
疑难解答