Bitmap decoder, handle resize & quality & compress stuff following user's configurations.

Overview

Android Arsenal

SoBitmap

SoBitmap is not an ImageLoader, it born for process single bitmap. Some conditions, we want a image displayed in some limit, such as the max size, the memory cost and its format. SoBitmap handle these all for you, then release you to concern the real important things. You can totally use SoBitmap as a black box, the only things you need care are the input configuration and the output bitmap.

Feature

  • support local file, MediaStore and network stream

  • support two config way:

    1. exact limit include max input, max output, and compress quality down step
    2. fuzzy limit that you only need set a level or just by default.
  • use okhttp as httpclient for downloading, I think we can trust it(Shall we have a choice about it?)

  • all callback heppen in UI thread, so relax about it

Usage

Include in your project

  • Gradle
repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}

dependencies {
	compile 'com.github.airk000:sobitmap:0.1.+'
}

Permissions

<!-- if SoBitmap need to load image from network -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- if your want use external storage for cache -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Min SDK

API9 (Android2.3)

Custom display option

Exactly
Options.ExactOptionsBuilder builder = new Options.ExactOptionsBuilder();
builder.step(10)
        .format(Bitmap.CompressFormat.JPEG)
        .maxOutput(200)
        .maxInput(10 * 1000)
        .maxSize(5000);
Options ops = builder.build();
Fuzzy
Options.FuzzyOptionsBuilder builder = new Options.FuzzyOptionsBuilder();
builder.maxSize(5000)
        .format(Bitmap.CompressFormat.PNG)
        .level(Options.QualityLevel.HIGH);
Options ops = builder.build();
Change the default option
SoBitmap.getInstance(context).setDefaultOption(myCustomOps);

Hunting bitmap

SoBitmap.getInstance(this).hunt(uri, new Callback() {
            @Override
            public void onHunted(Bitmap bitmap, BitmapFactory.Options options) {
                imageView.setImageBitmap(bitmap);
            }

            @Override
            public void onException(HuntException e) {
                textView.setText(e.toString());
            }
        });

TODO:

  • Multi thread speed up the decoding duration

License

Copyright 2016 Kevin Liu

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.
You might also like...
Android Gradle Plugin -- Auto Check big image and compress image in building.

McImage I will continue to update, please rest assured to use 中文文档 Android优雅的打包时自动化获取全部res资源 McImage is a Non-invasive plugin for compress all res in

An Android Image compress library, reduce's the size of the image by 90% without losing any of its pixels.
An Android Image compress library, reduce's the size of the image by 90% without losing any of its pixels.

Image Compressor An Android image compress library, image compressor, is small and effective. With very little or no image quality degradation, a comp

An Android application consuming the GitHub API to search for users on Github, display their followers, following and repositories. The project is built with Compose, MVVM pattern as well as other architectural components and libraries.
Barcode scanner library for Android, based on the ZXing decoder

ZXing Android Embedded Barcode scanning library for Android, using ZXing for decoding. The project is loosely based on the ZXing Android Barcode Scann

An implementation of a gif decoder written 100% in Kotlin, plus an associated Drawable for Android
An implementation of a gif decoder written 100% in Kotlin, plus an associated Drawable for Android

An implementation of a gif decoder written 100% in Kotlin, plus an associated Drawable for Android

ASN.1 encoder/decoder for Kotlin/Multiplatform

ASN.1 encoder/decoder for Kotlin/Multiplatform. Supports Android, iOS, JavaScript and plain JVM environments

Base64 encoder/decoder for Kotlin/Multiplatform

Base64 encoder/decoder for Kotlin/Multiplatform. Supports Android, iOS, JavaScript and plain JVM environments.

Hex string encoder/decoder for Kotlin/Multiplatform

Hex string encoder/decoder for Kotlin/Multiplatform. Supports Android, iOS, JavaScript and plain JVM environments.

Proguard configurations for common Android libraries

android-proguard-snippets Example Proguard configurations for common Android libraries. This project assumes that your ProGuard configuration is based

A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Proguard configurations for common Android libraries

android-proguard-snippets Example Proguard configurations for common Android libraries. This project assumes that your ProGuard configuration is based

A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar
A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar

#Android-LollipopShowcase This is a simple showcase to show off Android's all new Material Design and some other cool new stuff which is (new) in Andr

Gradle plugin for simplify Kotlin Multiplatform mobile configurations
Gradle plugin for simplify Kotlin Multiplatform mobile configurations

Mobile Multiplatform gradle plugin This is a Gradle plugin for simple setup of Kotlin Multiplatform mobile Gradle modules. Setup buildSrc/build.gradle

A creatively named utility for developing biome configurations for Terra
A creatively named utility for developing biome configurations for Terra

Biome Tool Biome Tool is a creatively named utility for developing biome configurations for Terra This is a simple dummy platform implementation that

A command line tool for NFT stuff

MartaKli is a command line tool to help you generate your NFT pfp project. Current features: Generate batch of images using different layers and corre

Hands-on experiments to demonstrate the exploitability of insecure TLS configurations in Android apps

Containerized Demo for Insecure TLS Certificate Checking in Android Overview Thi

A set of TestRules and ActivityScenarios to facilitate UI Testing under given configurations: FontSizes, Locales

AndroidUiTestingUtils A set of TestRules, ActivityScenarios and utils to facilit

Solana Ghidra Stuff (WIP)

SolDragon Solana Ghidra Stuff (WIP) TODO List: SLEIGH Definitions fix entrypoint Signature stub syscalls fix analysis plugin fix stack frames n SLEIGH

Comments
Glide Bitmap Pool is a memory management library for reusing the bitmap memory

Glide Bitmap Pool About Glide Bitmap Pool Glide Bitmap Pool is a memory management library for reusing the bitmap memory. As it reuses bitmap memory ,

AMIT SHEKHAR 573 Dec 31, 2022
Library to handle asynchronous image loading on Android.

WebImageLoader WebImageLoader is a library designed to take to hassle out of handling images on the web. It has the following features: Images are dow

Alexander Blom 102 Dec 22, 2022
Bitmap decoder, handle resize & quality & compress stuff following user's configurations.

SoBitmap SoBitmap is not an ImageLoader, it born for process single bitmap. Some conditions, we want a image displayed in some limit, such as the max

Kevin Liu 87 Aug 1, 2019
Glide Bitmap Pool is a memory management library for reusing the bitmap memory

Glide Bitmap Pool About Glide Bitmap Pool Glide Bitmap Pool is a memory management library for reusing the bitmap memory. As it reuses bitmap memory ,

AMIT SHEKHAR 573 Dec 31, 2022
Quality-Tools-for-Android 7.5 0.0 L5 Java This is an Android sample app + tests that will be used to work on various project to increase the quality of the Android platform.

Quality Tools for Android This is an Android sample app + tests that will be used to work on various project to increase the quality of the Android pl

Stéphane Nicolas 1.3k Dec 27, 2022
Help users of coding platforms to create findable, well documented, secure and offering good quality projects

The Ambassador The Ambassador will help users of coding platforms to create findable, well documented and offering good quality projects. It measures

F. Hoffmann-La Roche 15 Nov 7, 2022
RasmView - an Android drawing view; it provides a view that allows users to draw on top of a bitmap.

RasmView RasmView is an Android drawing library; it provides a view that allows users to draw on top of a bitmap. Demo https://www.youtube.com/watch?v

Raed Mughaus 39 Dec 23, 2022
Android Resource Manager application to manage and analysis your app resources with many features like image resize, Color, Dimens and code Analysis

Android Resource Manager application to manage and analysis your app resources with many features like image resize, Color, Dimens and code Analysis

Amr Hesham 26 Nov 16, 2022
v9 is an Android library that provides the ability to dynamically resize Path objects as you would 9-patch bitmaps

v9 is an Android library that provides the ability to dynamically resize Path objects as you would 9-patch bitmaps. In the example below, the chat bubble is dynamically resized while preserving the corners:

Romain Guy 304 Dec 27, 2022
Android library to choose image from gallery or camera with option to compress result image

ImagePicker Android library to choose image from gallery or camera with option to compress result image. Download Add this to your project's build.gra

Mayank Nagwanshi 73 May 20, 2022