Play with bitmaps

Overview

Android Arsenal Travis CI

BitmapMerger

Bitmap Merger is a simple project help you to merge two bitmaps without memory exceptions. The bitmaps are processed in background threads thereby taking the load away from UI thread. Along with merge, it also contains the image decoder for decoding images from resources/disk and are sampled to prevent OutOfMemoryError.

Examples of Bitmap Merger with this project

Merging at angle away Merging at center Merging with offsets
merge_angle_small merge_at_center_small merge_offset_small
Moon moving around the earth for various angles Stamp at center of the document being scaled Balloon flying in a beach with various offset values

###Usage :

####Merging at angle away

int angle = 90; // your angle here
float scale = 0.5f; // scaling option for merging the image
Bitmap baseBitmap; // your base bitmap here
Bitmap mergeBitmap; // your merging bitmap here
ImageView imgView; // your image view for displaying the merged bitmaps.
BitmapMergerTask task = new BitmapMergerTask();
            task.setBaseBitmap(baseBitmap)
                    .setMergeBitmap(mergeBitmap)
                    .setMergeListener(new BitmapMergerTask.OnMergeListener() {
                        @Override
                        public void onMerge(BitmapMergerTask task, Bitmap mergedBitmap) {
                            if(imgView != null) {
                              imgView.setImageBitmap(mergedBitmap);
                            }
                        }
                    })
                    .setScale(scale)
                    .setAngle(angle)
                    .merge();

####Merging at center

float scale = 0.5f; // scaling option for merging the image
Bitmap baseBitmap; // your base bitmap here
Bitmap mergeBitmap; // your merging bitmap here
ImageView imgView; // your image view for displaying the merged bitmaps.
BitmapMergerTask task = new BitmapMergerTask();
            task.setBaseBitmap(baseBitmap)
                    .setMergeBitmap(mergeBitmap)
                    .setMergeListener(new BitmapMergerTask.OnMergeListener() {
                        @Override
                        public void onMerge(BitmapMergerTask task, Bitmap mergedBitmap) {
                            if(imgView != null) {
                              imgView.setImageBitmap(mergedBitmap);
                            }
                        }
                    })
                    .setScale(scale)
                    .merge();

####Merging with offsets from top left

int leftOffset = 0; // your left offset in pixels
int topOffset = 0; // your top offset in pixels
float scale = 0.5f; // scaling option for merging the image
Bitmap baseBitmap; // your base bitmap here
Bitmap mergeBitmap; // your merging bitmap here
ImageView imgView; // your image view for displaying the merged bitmaps.
BitmapMergerTask task = new BitmapMergerTask();
            task.setBaseBitmap(baseBitmap)
                    .setMergeBitmap(mergeBitmap)
                    .setMergeListener(new BitmapMergerTask.OnMergeListener() {
                        @Override
                        public void onMerge(BitmapMergerTask task, Bitmap mergedBitmap) {
                            if(imgView != null) {
                              imgView.setImageBitmap(mergedBitmap);
                            }
                        }
                    })
                    .setScale(scale)
                    .setOffsets(leftOffset,topOffset)
                    .merge();

Developed By

You might also like...
Android library implementing a fading effect for the action bar, similar to the one found in the Play Music app
Android library implementing a fading effect for the action bar, similar to the one found in the Play Music app

FadingActionBar FadingActionBar is a library which implements the cool fading action bar effect that can be seen in the new Play Music app. This libra

android-delicious Delicious Android is an Android app which helps you access and save bookmarks via Delicious. It's available over at Google Play.
android-delicious Delicious Android is an Android app which helps you access and save bookmarks via Delicious. It's available over at Google Play.

Delicious Android Delicious Android is an Android app which helps you access and save bookmarks via Delicious. It's available over at Google Play. Fea

Play Android App

Play Android App Stream music and control the queue of a play server from your Android device. Dependencies ActionBarSherlock http-request android-pus

Tidy up your Android status bar before taking screenshots for the Play Store
Tidy up your Android status bar before taking screenshots for the Play Store

DEPRECATED This project no longer works on recent versions of Android. Use Android's build-in Demo mode instead. For the curious, more information abo

Android library to auto-play/pause videos from url in recyclerview.
Android library to auto-play/pause videos from url in recyclerview.

AutoplayVideos Show some ❤️ and star the repo to support the project This library is created with the purpose to implement recyclerview with videos ea

Android has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.
Android has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.

# Media Recorder Dialog ![](https://img.shields.io/badge/Platform-Android-brightgreen.svg) ![](https://img.shields.io/badge/Android-CustomView-blue.sv

Google Play game services - Android samples

Google Play game services - Android Samples Copyright (C) 2014 Google Inc. Contents These are the Android samples for Google Play game services. Colle

PlayPauseDrawable 1.9 0.0 L5 Java This is a sample Play & Pause Drawable with morphing animation for Android
PlayPauseDrawable 1.9 0.0 L5 Java This is a sample Play & Pause Drawable with morphing animation for Android

#PlayPauseDrawable #Deprecated please go to https://github.com/tarek360/Material-Animation-Samples This is a sample Play & Pause Drawable with morphin

A plug and play ;) android library for displaying a
A plug and play ;) android library for displaying a "rate this app" dialog

Easy Rating Dialog This lib provides a simple way to display an alert dialog for rating app. Default conditions to show: User opened the app more than

An Android Studio / IntelliJ plug-in help you upload your apk or listing to Google Play.

DroidLane An Android Studio / IntelliJ plug-in help you upload your apk or listing to Google Play. Installation Open Android Studio or IntelliJ IDEA O

RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)
RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)

Advanced RecyclerView This RecyclerView extension library provides Google's Inbox app like swiping, Play Music app like drag-and-drop sorting and expa

Small library that wraps Google Play Service API in brilliant RxJava Observables reducing boilerplate to minimum.

ReactiveLocation library for Android Small library that wraps Google Play Services API in brilliant RxJava Observables reducing boilerplate to minimum

Donations library for Android. Supports Google Play Store, Flattr, PayPal, and Bitcoin
Donations library for Android. Supports Google Play Store, Flattr, PayPal, and Bitcoin

Android Donations Lib Android Donations Lib supports donations by Google Play Store, Flattr, PayPal, and Bitcoin. It is used in projects, such as Open

Android's TextView that can expand/collapse like the Google Play's app description

ExpandableTextView ExpandableTextView is an Android library that allows developers to easily create an TextView which can expand/collapse just like th

Material style morphing play-pause drawable for Android
Material style morphing play-pause drawable for Android

Play There is no need to explain what this thing does, just take a look at the gif below. Including in your project Add to your root build.gradle: all

Donations library for Android. Supports Google Play Store, Flattr, PayPal, and Bitcoin
Donations library for Android. Supports Google Play Store, Flattr, PayPal, and Bitcoin

Android Donations Lib Android Donations Lib supports donations by Google Play Store, Flattr, PayPal, and Bitcoin. It is used in projects, such as Open

Google Play game services - Android samples

Google Play game services - Android Samples Copyright (C) 2014 Google Inc. Contents These are the Android samples for Google Play game services. Colle

Quizzon: Create and play quizzes free
Quizzon: Create and play quizzes free

QuizZon is an app to create and play quizzes Application Install You can Install and test latest QuizZon app from below 👇 Setup Clone the rep

Comments
  • add base iamge and merge image crash   (MI 4C  Android4.4.4KTU84P)

    add base iamge and merge image crash (MI 4C Android4.4.4KTU84P)

    05-02 18:43:52.065 26674-26983/com.cooltechworks.bitmapmerger E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 Process: com.cooltechworks.bitmapmerger, PID: 26674 java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) Caused by: com.cooltechworks.bitmapmerger.tasks.BitmapDecoderTask$BitmapDecodeException: Did not provide a valid Uri. at com.cooltechworks.bitmapmerger.tasks.BitmapDecoderTask.decodeSampledBitmapFromDisk(BitmapDecoderTask.java:181) at com.cooltechworks.bitmapmerger.tasks.BitmapDecoderTask.doInBackground(BitmapDecoderTask.java:126) at com.cooltechworks.bitmapmerger.tasks.BitmapDecoderTask.doInBackground(BitmapDecoderTask.java:25) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)  at java.lang.Thread.run(Thread.java:841) 

    opened by philos3 3
  • Error: Resolves to an APK archive which is not supported as a compilation dependency

    Error: Resolves to an APK archive which is not supported as a compilation dependency

    Hello, I encounter a compilation error, when I try to compile library in my app. I have already included Jitpack url and compile package. How can I solve this problem?

    opened by ziyaddin 2
  • wrong scale parameter of overlay bitmap

    wrong scale parameter of overlay bitmap

    I found a bug: Currently overlay bitmap is scaled by baseBitmap dimens Line 217 of file BitmapmergerTask.java has to change from: Bitmap overlayScaled = Bitmap.createScaledBitmap(overlayBitmap, (int) (baseBitmap.getWidth() * scale), (int) (baseBitmap.getHeight() * scale), true); to Bitmap overlayScaled = Bitmap.createScaledBitmap(overlayBitmap, (int) (overlayBitmap.getWidth() * scale), (int) (overlayBitmap.getHeight() * scale), true);

    Another improvement: Bitmap workingBitmap = Bitmap.createBitmap(baseBitmap); Bitmap mutableBitmap = workingBitmap.copy(Bitmap.Config.ARGB_8888, true); Above code generates 2 bitmaps and 'workingBitmap' is no need (waste of memory). We can modify it to: Bitmap mutableBitmap = baseBitmap.copy(Bitmap.Config.ARGB_8888, true);

    opened by toandk 1
Owner
Harish Sridharan
Harish Sridharan
Play with bitmaps

BitmapMerger Bitmap Merger is a simple project help you to merge two bitmaps without memory exceptions. The bitmaps are processed in background thread

Harish Sridharan 455 Mar 17, 2021
Play with bitmaps

BitmapMerger Bitmap Merger is a simple project help you to merge two bitmaps without memory exceptions. The bitmaps are processed in background thread

Harish Sridharan 459 Nov 7, 2022
Native-Blur: a C++/Kotlin library for blur bitmaps and activity, mobile-ready, android compatible

Native-Blur The Native-Blur is a C++/Kotlin libraray for blur bitmaps and activity, mobile-ready, android compatible, powered by Java Native Interface

Abolfazl Abbasi 26 Dec 13, 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 has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.

# Media Recorder Dialog ![](https://img.shields.io/badge/Platform-Android-brightgreen.svg) ![](https://img.shields.io/badge/Android-CustomView-blue.sv

Abdullah Alhazmy 73 Nov 29, 2022
A library that checks for your apps' updates on Google Play, GitHub, Amazon, F-Droid or your own server. API 9+ required.

AppUpdater Android Library Android Library that checks for updates on Google Play, GitHub, Amazon, F-Droid or your own server. This library notifies y

Javier Santos 1.9k Jan 2, 2023
Notify users when a new version of your Android app is available, and prompt them with the Play Store link. A port of the iOS library of the same name.

Siren for Android Notify users when a new version of your Android app is available, and prompt them with the Play Store link. This is a port of the iO

Quality Mobile Puzzle Apps 133 Nov 22, 2022
RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)

Advanced RecyclerView This RecyclerView extension library provides Google's Inbox app like swiping, Play Music app like drag-and-drop sorting and expa

Haruki Hasegawa 5.2k Dec 23, 2022
Android's TextView that can expand/collapse like the Google Play's app description

ExpandableTextView ExpandableTextView is an Android library that allows developers to easily create an TextView which can expand/collapse just like th

Manabu S. 4k Jan 8, 2023
A SeekBar suited for showing a preview of something. As seen in Google Play Movies.

PreviewSeekBar A SeekBar suited for showing a video preview. As seen in Google Play Movies Google Play Movies PreviewSeekBar's sample Build Add the fo

Rúben Sousa 3.3k Jan 3, 2023