【发布时间】:2016-11-24 16:57:26
【问题描述】:
当我在 Google 上搜索这个主题时, 1.
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ARGB_8888;
options.inSampleSize = 3;
if (bitmap == null) {
bitmap = BitmapFactory.decodeFile(filePath, options);
}
这意味着文件像素减少了 1000*1000 到 300*300。 和
2.
bitmap.compress(CompressFormat.JPEG, 80, bos);
这意味着大小(文件体积)减少了 1000kb -> 800kb。
对吗? 因为...当我上传一些图片时,如果文件很大,我无法上传。 (我检查了文件量减少了第二种方式,而不是第一种方式)
所以我尝试第一种方式但也失败了。但是当我尝试第二种方式时,我成功了!!
所以这就是我问这个问题的原因。
C.f> 如果我裁剪位图,位图会改变???
Bitmap croppedBitmap = null;
if (i!=cnt) {
if ((croppedStart + pageHeight) > webview.getMeasuredHeight()) {
int lastHeight = webview.getMeasuredHeight() - croppedStart;
croppedBitmap = Bitmap.createBitmap(bitmap, 0, croppedStart, webview.getMeasuredWidth(),lastHeight-1);
} else {
try{
croppedBitmap = Bitmap.createBitmap(bitmap, 0, croppedStart, webview.getMeasuredWidth(), pageHeight);
}catch(Exception e){
e.printStackTrace();
}
}
croppedStart += pageHeight;
rtn.add(croppedBitmap);
}
完成此操作后,我的位图(原始)将 fullBtimap 更改为 Last croppedBitmap。 也谢谢!
【问题讨论】: