合并后续

This commit is contained in:
kehaoyuan
2018-01-13 15:53:19 +08:00
parent 552b81c558
commit 6fef655e44
5 changed files with 90 additions and 68 deletions

View File

@ -8,6 +8,8 @@ import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.media.ExifInterface;
import com.lightgame.utils.Utils;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@ -64,7 +66,6 @@ public class BitmapUtils {
BitmapFactory.Options options = new BitmapFactory.Options();
Bitmap bitmap = BitmapFactory.decodeFile(filePath, options);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 85, bos);
float zoom = (float) Math.sqrt(compressSize / (float) bos.toByteArray().length);
@ -83,8 +84,11 @@ public class BitmapUtils {
result = Bitmap.createBitmap(result, 0, 0, result.getWidth(), result.getHeight(), matrix, true);
bos.reset();
result.compress(Bitmap.CompressFormat.JPEG, 85, bos);
Utils.log("========11::" + bos.toByteArray().length );
}
Utils.log("========22::" + bos.toByteArray().length );
File file = new File(newPath);
try {
BufferedOutputStream fbos = new BufferedOutputStream(new FileOutputStream(file));
@ -94,6 +98,8 @@ public class BitmapUtils {
return false;
}
File file1 = new File(newPath);
Utils.log("========zzz::" + file1.length() );
return true;
}