Giter Site home page Giter Site logo

Comments (10)

ChenSiLiang avatar ChenSiLiang commented on May 18, 2024 1

好 那具体拍出来的图片多大 5M?
应该对大图采取压缩策略比较合适 因为想存下来的图尽量清晰

from boxing.

ChenSiLiang avatar ChenSiLiang commented on May 18, 2024

这个是写文件操作。
如果像你这样修改,那不需要旋转的时候就不写文件了啊。

from boxing.

hxzpp avatar hxzpp commented on May 18, 2024

不需要旋转的时候还需要写文件吗,默认拍照完成的时候已经写文件了啊

from boxing.

ChenSiLiang avatar ChenSiLiang commented on May 18, 2024

有道理,我改下,感谢反馈。

from boxing.

hxzpp avatar hxzpp commented on May 18, 2024

这里还有个细节要改一下哦,就是在三星s5和魅族2都会oom,我看下主要是图片太大了,应该旋转的时候先压缩下哦,我改了下,效果不错,可以加个好友聊聊,这个项目开源非常的不错哦 373486276

from boxing.

hxzpp avatar hxzpp commented on May 18, 2024

try {
int degree = BoxingExifHelper.getRotateDegree(file.getAbsolutePath());
Matrix matrix = new Matrix();
if (degree != 0) {
matrix.postRotate(degree);
bitmap = ImageCompressor.compressSize(file.getAbsolutePath());
outBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, false);
outputStream = new FileOutputStream(file);
outBitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
outputStream.flush();
}
return true; 我是这么处理的,适配了不少机型,都不错

from boxing.

ChenSiLiang avatar ChenSiLiang commented on May 18, 2024

拍出来的图片会有多大?

from boxing.

hxzpp avatar hxzpp commented on May 18, 2024

在三星s5上,我算了下图片加载到内存的时候将近50M,直接爆了

from boxing.

hxzpp avatar hxzpp commented on May 18, 2024

差不多吧,拍照图片一般在4-5M左右,加载到内存大概在40-50M左右,所以容易爆炸,ImageCompressor中的compressDisplay方法压缩应该能达到预期的效果。

from boxing.

hxzpp avatar hxzpp commented on May 18, 2024

我本来想把画质options.inPreferredConfig = Bitmap.Config.RGB_565;也压缩下,想想怕质量受到影响就暂时不做,先按compressDisplay做,然后测试N个机型,看看反馈的情况在定。。。你有什么好建议记得发我下。

from boxing.

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.