Comments (3)
您好,我在项目中引用了一个图片选择库,并且剪裁之后使用您的库进行压缩,然而打印日志发现了一个问题。剪裁出的圆形图片压缩后,file依然是原文件,使用其他剪裁出来的图片可以正常压缩,想请教一下是什么原因。
这是我用的图片库地址:https://github.com/yangpeixing/YImagePicker
首先检查你裁剪后的输出资源的正确性,裁剪api调用是否正确。一般裁剪后的图片大小已经可以接受了,考虑下是否还需要压缩
from kluban.
裁剪确实是正确的,当我裁剪出一个方形图片的时候,压缩该图是有用的。当我裁剪圆形图片的时候,压缩是无效的,返回的file和压缩前是一个对象。大图和小图都是如此,您可以试一试
from kluban.
我重试几次后发现,有的图不会被压缩
我的打印日志是:
压缩原图大小 : 8038910
ploadImage: 开始压缩
ploadImage: 压缩后大小 : 2704757
ploadImage: 压缩完成
压缩原图大小 : 877276
ploadImage: 开始压缩
ploadImage: 压缩后大小 : 877276
ploadImage: 压缩完成
压缩原图大小 : 121402
ploadImage: 开始压缩
ploadImage: 压缩后大小 : 121402
ploadImage: 压缩完成
压缩原图大小 : 6378804
ploadImage: 开始压缩
ploadImage: 压缩后大小 : 2269838
ploadImage: 压缩完成
调用代码是Luban.with().load(filePath).useDownSample(true).ignoreBy(200).quality(70).compressObserver {
onSuccess = {
Timber.d("压缩后大小 : ${it.length()}")
from kluban.
Related Issues (20)
- 你好,压缩的话,怎么直接传list集合, HOT 10
- rename 返回的是整个路径不是文件名 HOT 2
- 会出现压缩后反而更大的情况,文件有后缀的时候输出文件还会再加一次后缀。 HOT 6
- load()传入List<Uri> 返回为空 HOT 1
- heic图片压缩后旋转 HOT 4
- 如何避免重复压缩同一张图片 HOT 1
- 大神 java版本调用 如何在compressObserver中获取压缩后的File? 对kotlin不太熟悉 可以出个java版本的demo吗
- 压缩图片抛InvalidMarkException HOT 3
- 选择不并行(useConcurrent为false)时,onSuccess list为空 HOT 1
- 上传部分图片时会抛出异常:InvalidMarkException: Mark has been invalidated, pos: 1423393 markLimit: 5242880 HOT 2
- 有一些jpg图片会有格式识别不出来的情况
- 编译失败, 2 files found with path 'META-INF/library_release.kotlin_module'. HOT 1
- 能解答一下,这不部分的计算是根据啥么?
- asyncRun这段代码的协程handler里面应该回调error吧,不然报错了,也没有回调,就卡在那了 HOT 1
- load(bitmap) 输出只有Bitmap.CompressFormat.JPEG格式,后面checker 头的时候也会把png图片也当成JPEG
- 既然都使用协程了为什么不能提供suspend方法?
- 压缩超长图片,特别耗时的问题
- 16K图片压缩问题 HOT 4
- 建议加一下宽高限制
- InputStream mark问题 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kluban.