Luban

Luban(鲁班)—Image compression with efficiency very close to WeChat Moments/可能是最接近微信朋友圈的图片压缩算法
Alternatives To Luban
Select To Compare


Readme

Luban

Build Status Download

Luban Android

Luban-turbo turbotrubo

App

App``Luban100

Luban

| | Luban | Wechat ---- | ---- | ------ | ------ 720P |7201280,390k|7201280,87k|7201280,56k 1080P|10801920,2.21M|10801920,104k|10801920,112k 13M(4:3)|30964128,3.12M|15482064,141k|15482064,147k 9.6M(16:9)|41282322,4.64M|1032581,97k|1032581,74k |10806433,1.56M|10806433,351k|1080*6433,482k

implementation 'top.zibin:Luban:1.1.8'

| ---- | ---- load | filter | ignoreBy | K setFocusAlpha |
setTargetDir | setCompressListener | setRenameListener |

Luban``IO

Luban.with(this)
        .load(photos)
        .ignoreBy(100)
        .setTargetDir(getPath())
        .filter(new CompressionPredicate() {
          @Override
          public boolean apply(String path) {
            return !(TextUtils.isEmpty(path) || path.toLowerCase().endsWith(".gif"));
          }
        })
        .setCompressListener(new OnCompressListener() {
          @Override
          public void onStart() {
            // TODO  loading UI
          }

          @Override
          public void onSuccess(File file) {
            // TODO 
          }

          @Override
          public void onError(Throwable e) {
            // TODO 
          }
        }).launch();

rxJava

Flowable.just(photos)
    .observeOn(Schedulers.io())
    .map(new Function<List<String>, List<File>>() {
      @Override public List<File> apply(@NonNull List<String> list) throws Exception {
        // 
        return Luban.with(MainActivity.this).load(list).get();
      }
    })
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe();

RELEASE NOTE

Here

License

Copyright 2016 Zheng Zibin

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Popular Media Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Image Compression