特点:
1、支持压缩单张图片和多张图片
使用方法
1、添加依赖
Step 1. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.nanchen2251:CompressHelper:1.0.5'
}
2、在Activity里面使用
File newFile = CompressHelper.getDefault(this).compressToFile(oldFile);
3、你也可以自定义属性
File newFile = new CompressHelper.Builder(this)
.setMaxWidth(720) // 默认最大宽度为720
.setMaxHeight(960) // 默认最大高度为960
.setQuality(80) // 默认压缩质量为80
.setFileName(yourFileName) // 设置你需要修改的文件名
.setCompressFormat