Skip to content

Commit

Permalink
Merge branch 'master' into bintray
Browse files Browse the repository at this point in the history
* master:
  修复 'quality must be 0..100' 的 bug
  修复[0.5625,0.5)区间成像模糊的问题
  Update README.md
  • Loading branch information
郑梓斌 committed Aug 10, 2016
2 parents e8281d2 + c6a50b4 commit 6d03cae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[English](/Translation/README-EN.md)
中文 | [English](/Translation/README-EN.md)

# Luban
Luban(鲁班)——Android图片压缩工具,仿微信朋友圈压缩策略
Expand Down
4 changes: 2 additions & 2 deletions library/src/main/java/top/zibin/luban/Luban.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private File thirdCompress(@NonNull File file) {
int multiple = height / 1280 == 0 ? 1 : height / 1280;
thumbW = width / multiple;
thumbH = height / multiple;
size = (thumbW * thumbH) / (1440.0 * 2560.0) * 200;
size = (thumbW * thumbH) / (1440.0 * 2560.0) * 400;
size = size < 100 ? 100 : size;
} else {
int multiple = (int) Math.ceil(height / (1280.0 / scale));
Expand Down Expand Up @@ -425,7 +425,7 @@ private File saveImage(String filePath, Bitmap bitmap, long size) {
int options = 100;
bitmap.compress(Bitmap.CompressFormat.JPEG, options, stream);

while (stream.toByteArray().length / 1024 > size) {
while (stream.toByteArray().length / 1024 > size && options > 6) {
stream.reset();
options -= 6;
bitmap.compress(Bitmap.CompressFormat.JPEG, options, stream);
Expand Down

0 comments on commit 6d03cae

Please sign in to comment.