#使用
maven { url 'https://jitpack.io' }
compile 'com.github.wangdanlizhiyun:JpegCompress:v1.0.4'
开启log
JpegCompressUtil.log(true);
压缩为新文件
compress(File imageFile, String path)
压缩并覆盖原始文件
compressAndCorverOldFile(File imageFile)
示例代码:
LifeUtil.permission(PermissionType.WRITE_EXTERNAL_STORAGE, PermissionType.READ_EXTERNAL_STORAGE).run(new Runnable() {
@Override
public void run() {
File file = new File(Environment.getExternalStorageDirectory(), "danhao.jpg");
// File out=new File(Environment.getExternalStorageDirectory(),"jpegeded"+".jpg0");
// JpegCompressUtil.compress(file,out.getAbsolutePath());
JpegCompressUtil.compressAndCorverOldFile(file);
}
});