china_hgb 2016-02-05 23:07 采纳率: 100%
浏览 1528
已采纳

inSampleSize的参数是怎么计算出来的?它有什么用?

 Bitmap bitmap = null;  
 BitmapFactory.Options opts = new BitmapFactory.Options();  
 opts.inJustDecodeBounds = true;  
 BitmapFactory.decodeFile(filePath, opts);  

 opts.inSampleSize = computeSampleSize(opts, -1, 128*128);  
 opts.inJustDecodeBounds = false;  

 try {  
     bitmap = BitmapFactory.decodeFile(filePath, opts);  
 }catch (Exception e) {  
    // TODO: handle exception  
} 
  • 写回答

3条回答

  • threenewbee 2016-02-05 23:36
    关注

    inSampleSize
    根据字面意思,输入的采样大小。这个值越大,说明压缩比越高。但是图片质量越低。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试