Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

大神 java版本调用 如何在compressObserver中获取压缩后的File? 对kotlin不太熟悉 可以出个java版本的demo吗 #18

Open
qianmohunchen opened this issue Aug 5, 2021 · 0 comments

Comments

@qianmohunchen
Copy link

Luban.Companion.with(ProcessLifecycleOwner.get())
.load(bitmap)
.setOutPutDir(PathUtils.getExternalAppPicturesPath())
.useDownSample(true) //(可选)压缩算法 true采用邻近采样,否则使用双线性采样(纯文字图片效果绝佳)
.format(Bitmap.CompressFormat.JPEG)//(可选)压缩后输出文件格式 支持 JPG,PNG,WEBP
.ignoreBy(250) //(可选)期望大小,大小和图片呈现质量不能均衡所以压缩后不一定小于此值,
.quality(100) //(可选)质量压缩系数 0-100
.compressObserver(new Function1<CompressResult<Bitmap, File>, Unit>() {
@OverRide
public Unit invoke(CompressResult<Bitmap, File> bitmapFileCompressResult) {
bitmapFileCompressResult.setOnSuccess(new Function1<File, Unit>() {
@OverRide
public Unit invoke(File file) {
return null;
}
});
return null;
}
})
.launch();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant