2017-07-11 21 views

回答

0

我建議的步驟是:

  1. 後可以將其轉換裁剪JPG與此代碼

    Bitmap bMap = BitmapFactory.decodeFile(imgPath); 
    
  2. 保存BMAP與BMP extention位圖,你可以按照提示功能在HERE

  3. 刪除裁剪後的jpg文件以釋放內存

    File dir = getFilesDir(); 
    
    File file = new File(dir, "filename"); 
    
    if (file.exists()) { 
    
    boolean deleted = file.delete(); 
    
    } 
    
0

試試下面的代碼 -

  FileOutputStream out = null; 
      try { 
       out = new FileOutputStream(AbsoluteFilePath); 
       bmp.compress(Bitmap.CompressFormat.PNG, 100, out); // bmp is your Bitmap instance 
       // PNG is a lossless format, the compression factor (100) is ignored 
      } catch (Exception e) { 
       e.printStackTrace(); 
      } finally { 
       try { 
        if (out != null) { 
         out.close(); 
        } 
       } catch (IOException e) { 
        e.printStackTrace(); 
       } 
      } 

來源:Save bitmap to location

相關問題