Coder Social home page Coder Social logo

Comments (3)

forJrking avatar forJrking commented on May 27, 2024

您好,我在项目中引用了一个图片选择库,并且剪裁之后使用您的库进行压缩,然而打印日志发现了一个问题。剪裁出的圆形图片压缩后,file依然是原文件,使用其他剪裁出来的图片可以正常压缩,想请教一下是什么原因。
这是我用的图片库地址:https://github.com/yangpeixing/YImagePicker

首先检查你裁剪后的输出资源的正确性,裁剪api调用是否正确。一般裁剪后的图片大小已经可以接受了,考虑下是否还需要压缩

from kluban.

HeJingWei avatar HeJingWei commented on May 27, 2024

裁剪确实是正确的,当我裁剪出一个方形图片的时候,压缩该图是有用的。当我裁剪圆形图片的时候,压缩是无效的,返回的file和压缩前是一个对象。大图和小图都是如此,您可以试一试

from kluban.

HeJingWei avatar HeJingWei commented on May 27, 2024

我重试几次后发现,有的图不会被压缩
我的打印日志是:
压缩原图大小 : 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.