Drawable Optimizer


Source link: https://github.com/fabiomsr/drawable-optimizer

Drawable Optimizer

Gradle plugin to optimize png files and reduce resultant apk size within an Android project.

How it works ?

With this plugin you will be able to optimize the png files size inside your AndroidStudio project. It works over the folder in which the resource merging was executed, by default in a Mac OSX system is app\build\intermediates\res\merged.

By doing this, all original png files are kept under /res folder and this optimization could be undone just cleaning the project.

In order to perform an optimization task, this plugin offers 2 different ways of file compression:

  • Pngtastic library, which brings its own compressor.
  • Zopfli, which offers ridiculously good compression ratios in exchange of low compression speed.

Why should I use this plugin ?

You can find an explanation from Colt McAnlis about why you should optimize your pngs Reducing PNG file Size and Smaller PNGs, and Android’s AAPT tool

Taste

Original Optimized
525.51k 473.20k

Usage

Just click on Sync project with gradle files button

Download & Installation

In build.gradle

buildscript {

  repositories {

jcenter()
  
}

  dependencies {

classpath 'org.fabiomsr:drawable-optimizer-gradle-plugin:1.0.4'
  
}
 
}

And in app\build.gradle

// Make sure this line comes *after* you apply the Android plugin (apply plugin: 'com.android.application') apply plugin: 'org.fabiomsr.drawableoptimizer'

Configuration

No configuration is needed by default, but if you want you can configure the following parameters. Every time the configuration changes the project must be cleaned.

In app\build.gradle

drawableOptimizer {

  optimizer = 'zopfli'
  compressionLevel = 9
  iterations = 15
  onlyOnRelease = true
  logLevel = 'info' 
}
Parameter Description Values Default Value
optimizer Compressor to use zopfli or pngtastic zopfli
compressionLevel Compression level (useful for pngtastic compressor) 0-9 allowed Brute forces with every allowed value
iterations Compression iterations number (useful for zopfli) > 0 15
onlyOnRelease Only release signed optimization true or false false
logLevel Output Logging level none, debug, info or error info

License

Copyright 2016 Fabio Santana (fabiomsr)  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. 

Resources

Matisse is a well-designed local image and video selector for Android. You can

  • Use it in Activity or Fragment
  • Select images including JPEG, PNG, GIF and videos including MPEG, MP4
  • Apply different themes, including two built-in themes and custom themes
  • Different image loaders
  • Define custom filter rules

Meepo is a retrofit-like router generator for Android. You can use it to create routers for Activities, Fragments and even any things.

Use multiple analytics and other trackers in your Application easily.

Swipe3DRotateView is a class designed to simplify the implementation of 3D Flip Rotation in android based on swipe gestures.

Swipe3DRotateView is extended from a Framelayout and should exactly contain 2 views as its children. It detects swipe gestures on its child view, and based on the swipe direction, rotates the children in a 3D manner on their X or Y axis.

Encryptor4j consists of a set of wrapper and utility classes that make leveraging cryptography in your application alot easier.

It enables developers to encrypt and decrypt with little room for error, using few lines of code and supports all popular encryption algorithms such as AES, DES, RSA etc.

Android's ImageView pinch-to-zoom made easy.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes