Coder Social home page Coder Social logo

mcimage's Introduction

McImage

Gitter

中文文档

Android优雅的打包时自动化获取全部res资源

McImage is a Non-invasive plugin for compress all res in your project.

Include

  • The img in Jar
  • The img in AAR
  • The img in Module

Used algorithm

Release Success!

The version 1.0.1 now support all build.gradle version!

Feature

  • Compress all png and jpg, every img can save %70 size.
  • As far as possible to convert img to webp (after v0.0.3 support)
  • Auto match the system which you build your project.Include Linux,Mac OS X and Windows (after v0.0.4 support)
  • Use this plugin only need one line code.

Update Log

The user use v0.0.2 update plugin need update your mctools dir together.

  • 1.0.1 : Bug fix, fix maxSize float error
  • 1.0.0 : Support AAPT2 , now don't need to close aapt2 with "android.enableAapt2=false", you can delete this line in gradle.properties.
  • 0.1.4 : Bug fix, add the white list feature, add the img width and height check feature.
  • 0.1.2 : Bug fix(Fix the problem that check image size not work)
  • 0.1.1 : Bug fix(Fix the problem not work for module and fix the problem of enableWhenDebug not work)
  • 0.0.4 : Add auto choose system future.Remove webpQualitu config (Set inappropriate will result the img lossless)
  • 0.0.3 : Add webp ! It will auto convert your png (without alpha in min API < 18 and not work in min API < 14) and jpg to webp if it will become more small.
  • 0.0.2 : Improve the log.

Who is using

I can put your icon with one link at here if you use McImage. My email [email protected]

Use

The first, add the plugin in your project root build.gradle.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.smallsoho.mobcase:McImage:1.0.1'
    }
}

Then, apply the plugin in your every module.PS: If you have one more Module, you need apply it in every one.

apply plugin: 'McImage'

Last, put the mctools dir in your project root dir.Download it here

mctools

Config

You can set the config in build.gradle.If you not set this,all config will use default.

McImageConfig {
  isCheck true //default true
  isCompress true //default true
  maxSize 1*1024*1024 //default 1MB
  isWebpConvert true //default true
  isJPGConvert true //default true
  enableWhenDebug true //default true
  isCheckSize true //default true
  maxWidth 500 //defualt 500 the default size of check size feature
  maxHeight 500 //defualt 500 the default size of check size feature
  whiteList = [
    "drawable-xxhdpi-v4/img_five_stars.png" //add this line, the plugin can not deal with this img.
  ]
}

Thanks

pngquant

guetzli

cwebp

License

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.

mcimage's People

Contributors

forsail avatar smallsohosolo avatar

Watchers

 avatar

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.