- Java 76.4%
- C++ 22.9%
- Makefile 0.7%
| art | Add Project | |
| config | Disable findBugs and Pmd | |
| example | fix: remove setHasFixedSize call | |
| gradle/wrapper | Upgrade dependencies and project settings | |
| imagefilters | feat: Increase minSdk to 23 | |
| .gitignore | prepare before upgrade | |
| .travis.yml | Update target/compile sdk to 23 | |
| build.gradle | update version to 1.0.8.1 | |
| gradle.properties | Upgrade dependencies and project settings | |
| gradlew | Add Project | |
| gradlew.bat | Add Project | |
| LICENSE | Add Project | |
| local.properties | Upgrade dependencies and project settings | |
| README.md | Update README.md | |
| settings.gradle | local | |
Android Photo Filters
This library is forked from here. All credits goes to respective owners.
This fork version migrates all deprecated android.support to 'androidx.appcompat' so you can completely set jetifier to false
I also upgrade targetSdk to 36
How to use the Library
- Add to root (build.gradle (project)) at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Include the Filters library in build.gradle
dependencies {
implementation 'org.codeberg.Arne:AndroidPhotoFilters:1.0.8.1'
}
- Load the native library in your activity
publicclass MainActivityextendsAppCompatActivity{static{System.loadLibrary("NativeImageProcessor");}- Get the pre defined Filter Pack to generate the thumbnails. Refer FilterPack.java to generate your own filters.
List<filter>filters=FilterPack.getFilterPack(getActivity());for(Filterfilter:filters){ThumbnailItemitem=newThumbnailItem();item.image=thumbImage;item.filter=filter;item.filterName=filter.getName();ThumbnailsManager.addThumb(tI);}- Apply desired filter on to bitmap image.
// Accessing single filter...Bitmapbitmap=your_bitmap_;Filterclarendon=FilterPack.getClarendon();// apply filterimagePreview.setImageBitmap(filter.processFilter(bitmap));The Filter Pack
Currently the below filters are available in filer pack. More will be added in future.
Features
(This is the older documentation from original page)
PhotoFiltersSDK processes filter on any Image within fraction of second since processing logic is in NDK. At present following image filters are included:
- ToneCurveSubfilter : With this powerful filter you can change RGB channels of any image to create great results.
- SaturationSubfitler : Used for changing color saturation of an image.
- ColorOverlaySubfilter : As name suggests you can overlay any image with color of your choice.
- ContrastSubfilter : Used for changing contrast value of image.
- BrightnessSubfilter : To change brightness levels.
- VignetteSubfilter : To apply vignette effect on image.
FiltermyFilter=newFilter();myFilter.addSubFilter(newBrightnessSubFilter(30));myFilter.addSubFilter(newContrastSubFilter(1.1f));BitmapoutputImage=myFilter.process(inputImage);Above code snippet will give you outputImage with increased brightness and contrast. You can further refer example project.
Documentation
Although there are few inbuilt filters already present, you may want to create and customize one specific to your need and show your creativity. For that you would require to know how all the Subfilters can be used. Let me take you through all of them.
ToneCurveSubfilter
This is most awesome filter present in this library which differentiates PhotoFiltersSDK from other image processing libraries out there. ToneCurveSubFilter applies the changed RGB Channel curve to create effect on image.
Here is the code snippet the apply the above RGB curve on an image :
FiltermyFilter=newFilter();Point[]rgbKnots;rgbKnots=newPoint[3];rgbKnots[0]=newPoint(0,0);rgbKnots[1]=newPoint(175,139);rgbKnots[2]=newPoint(255,255);myFilter.addSubFilter(newToneCurveSubfilter(rgbKnots,null,null,null));BitmapoutputImage=myFilter.process(inputImage);The results are nearly same as we would see in photoshop and other tools. We can also specify knots for Red, Green and Blue channels (in the ToneCurveSubfilter's constructor).
SaturationSubfilter
This fitler can be used to tweak color saturation of an image. Here is the example :
FiltermyFilter=newFilter();myFilter.addSubFilter(newSaturationSubfilter(1.3f));BitmapoutputImage=myFilter.process(inputImage);SaturationSubfilter takes float as an argument and has no effect for value 1.
ColorOverlaySubfilter
Increases the specified red, green and blue values for each pixel in an image.
FiltermyFilter=newFilter();myFilter.addSubFilter(newColorOverlaySubfilter(100,.2f,.2f,.0f));BitmapoutputImage=myFilter.process(inputImage);ContrastSubfilter
To change the contrast levels of an image use this filter :
FiltermyFilter=newFilter();myFilter.addSubFilter(newContrastSubfilter(1.2f));BitmapoutputImage=myFilter.process(inputImage);ContrastSubfilter takes float as an argument where value 1 has no effect on the image.
BrightnessSubfilter
As the name suggest, this filter is used for changing brightness levels :
FiltermyFilter=newFilter();myFilter.addSubFilter(newBrightnessSubfilter(30));BitmapouputImage=myFilter.process(inputImage);BrightnessSubfilter takes int as an argument where value 0 has no effect. Negative values can be used to decrease brightness of the image.
VignetteSubfilter
This filter can be used to put vignette effect on the image.
FiltermyFilter=newFilter();myFilter.addSubFilter(newVignetteSubfilter(context,100));BitmapoutputImage=myFilter.process(inputImage);VignetteSubfilter takes int as an argument whoes value ranges from 0-255, which defines intesity of the vignette effect.
License
This library falls under Apache v2