WebpifyYourAndroidApp


Source link: https://github.com/AndroidDeveloperLB/WebpifyYourAndroidApp

WebpifyYourAndroidApp

A small tool to convert your app's png&jpg image files into WebP when possible

Sample video:

How to use

If you use Windows OS, just run the executable jar file that's inside the repo, inside "Release\WindowsOs". Then, drag the file/s&folder/s into the app, or put the paths of them into the textBox, choose the settings you wish, and press the conversion button ("do it").

If you use MacOs or Linux (which I haven't tried), here's what you should probably do:

  1. Install latest JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html
  2. Install Eclipse with Java development support: https://eclipse.org/downloads/
  3. Install Window-Builder: https://eclipse.org/windowbuilder/
  4. Download SWT (the "swt.jar" file is enough), and put it inside "external" folder: https://www.eclipse.org/swt/
  5. Download the converter executable file ("cwebp") and put it inside "external" folder: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html
  6. Open the project via Eclipse, make sure the "swt.jar" that you've downloaded is used. Run it via Eclipse to see that it works. If it does, you can export it as a runnable jar file and run it from outside Eclipse.
  7. You are good to go!

Advantages and features

  1. Converts png&jpg into WebP format when possible.
  2. Can also convert png to jpg files, if they are non-transparent (meaning not even a single pixel has a non-100%-opaque color)
  3. Should work on all OSs (yet tested on Windows only)
  4. Can handle all supported image files of all folders that are given, or only those on res/drawable* and res/mipmap* (which works this way by default)
  5. Supports drag&drop of files&folders, or entering full paths to them, separated by ";". Will handle all sub-directories, recursively.
  6. Supports level of encoding quality for both Jpeg and WebP
  7. Shows progress and summary of how many files were handled and how much space was saved.
  8. Native look&feel of the OS (because it uses SWT).
  9. Skips 9-patch images, as they aren't supported in WebP format anyway.

Disadvantages, issues, and To-do's

  1. Ugly UI, but still functional. I wanted to make this tool for developers anyway. I'm not as familiar with SWT as I am with Android, and I didn't want to spend too much time on it.
  2. Supports only png&jpg as input image files. Should be possible to handle gif files too
  3. Uses executable converter files instead of JNI.
  4. Since I'm not sure how to make the same project work well on multiple OSs (needed SWT and converter file for each), and since I don't have other OSs currently, it was only developed&tested on Windows OS.
  5. The tool doesn't remember which files were already handled from last time. It will go over all of them each time.
  6. Chosen settings aren't saved for next sessions. It also doesn't remember which files were already handled for next sessions
  7. Doesn't parse the gradle files. Instea, it assumes the folders structures of "res/drawable*" and "res/mipmap*" for the image files to handle. You can disable this check, and let it convert all supported files in all sub-directories of the given path.
  8. A bit slow, but this is in order to compress the files using the best space-saving algorithm.
  9. There should be a console/command-line tool, and not just UI-based tool.

I hope that this tool will be useful for all Android developers. I've also tried to suggest having such a tool within the IDE itself:

https://code.google.com/p/android/issues/detail?id=202923

Resources

Markdown view for Android. Display Markdown in your apps, useful for FAQs, Help, Size Guides, About screens etc. To make things really easy there's an Activity included, just use the included IntentBuilder.

A simple library for delivery bitmaps using reactive approach.

A slider that allows a user to select a value at one of the specified tickmarks.

Composable adapters for Android RecyclerViews and ListViews.

Pulse animation for Android.

Blorm is a field validation lib for android.

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