Coder Social home page Coder Social logo

compressor's Introduction

Compressor

Picture compression for android.

支持精确设置压缩分辨率,支持自动旋转照片角度(8种角度)

使用方式

// compress 是耗时操作,需要异步
coroutineScope.launch {
    val result = Comporessor.compress(
        context = context,
        file = File("xxx.jpg"),
        maxResolution = 1080,
        quality = 70,
    )
}

maxResolution 是压缩后图片的最大分辨率(长边不超过 maxResolution)。 且maxResolution 是精确匹配的,假设原图分 辨率是 4000 x 3000, maxResolution 是 1920,那么图片的分辨率会被精确的压缩到 1920 x 1440。

Demo 演示说明

screenshot

  1. 标题栏右上角选择需要压缩的图片;
  2. 屏幕上半部分显示的时原图,下半部分显示的是压缩后的图片;
  3. 底部是控制压缩参数,拖动进度条调整参数,参数变更时会实时响应。

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.