Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sharish/BitmapMerger
Play with bitmaps
https://github.com/sharish/BitmapMerger
Last synced: 14 days ago
JSON representation
Play with bitmaps
- Host: GitHub
- URL: https://github.com/sharish/BitmapMerger
- Owner: sharish
- License: mit
- Created: 2015-06-30T17:53:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-06T17:11:00.000Z (over 6 years ago)
- Last Synced: 2024-08-07T11:11:10.602Z (3 months ago)
- Language: Java
- Size: 211 KB
- Stars: 459
- Watchers: 22
- Forks: 70
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- -awesome-android-ui - BitmapMerger
- awesome-android-ui - BitmapMerger
- awesome-android-ui - BitmapMerger
README
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-BitmapMerger-green.svg?style=flat)](https://android-arsenal.com/details/1/2085) [![Travis CI](https://api.travis-ci.org/cooltechworks/BitmapMerger.svg?branch=master)](https://travis-ci.org/cooltechworks/BitmapMerger/)
# 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](https://cloud.githubusercontent.com/assets/13122232/8438305/9f7c2644-1f82-11e5-8f51-25ba7cca0711.gif) | ![merge_at_center_small](https://cloud.githubusercontent.com/assets/13122232/8438306/9f83ee9c-1f82-11e5-8734-954a13f1b2f2.gif) | ![merge_offset_small](https://cloud.githubusercontent.com/assets/13122232/8438307/9f8d7c78-1f82-11e5-8d77-7fb9f31dfd6f.gif)
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
```java
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
```java
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
```java
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
============* Harish Sridharan -