Free Java API for Working with Image
Open Source Java Photo Editing and manipulation Library that enable software developers to draw on images, apply filter effect on images, adding/editing Text, adding Emoji, and so on.
Photo Editor Library makes it easy for software programmers to edit as well as manipulate images using a couple of lines of Java code. The library is very stable and gives Java developers complete control over their images. Developers can easily apply Brush's Color, Size, Opacity, fonts, text, and much more while editing your images.
Photo Editor is an open source library and is available under the MIT License. There are several important features part of the library, such as drawing on an image, applying filter effects on the image, adding text to images, editing existing text, inserting emoji with custom fonts, inserting images and stickers, scaling images, rotating image view, delete views, undo and redo brushes commands and so on.
Getting Started with PhotoEditor
The easiest and recommended way to install PhotoEditor is via GitHub. Please use the following command for an easy and smooth installation.
Install PhotoEditor via GitHub
go get -u https://github.com/burhanrashid52/PhotoEditor.git
Creating New Images via Java
The open source PhotoEditor library has included several important functionalizes related to drawing on images using Java commands. You can customize the brushes and paint with a different set of properties. Please remember that you need to enable the drawing mode before starting the drawing on the image. Moreover, setting any property of a brush for the drawing will also automatically enable the drawing mode.
Save Image as A Bitmap via Java API
mPhotoEditor.saveAsBitmap(new PhotoEditor.OnSaveBitmap() {
@Override
public void onBitmapReady(@NonNull Bitmap saveBitmap) {
Log.e("PhotoEditor","Image Saved Successfully");
}
@Override
public void onFailure(@NonNull Exception exception) {
Log.e("PhotoEditor","Failed to save Image");
}
});
Applying Custom Filters on Image
The PhotoEditor library enables software developers to apply filters on their source images inside their Java apps. The library has included both inbuilt as well as custom filter facilities. By default, you can use some commonly available filters with just a one-liner code. You can also build your own custom filters and apply them with ease. Please note that some effects may not be available on all platforms, so please check before creating a certain effect.
Apply Custom Filters via Java
CustomEffect customEffect = new CustomEffect.Builder(EffectFactory.EFFECT_BRIGHTNESS)
.setParameter("brightness", 0.5f)
.build();
mPhotoEditor.setFilterEffect(customEffect);
Working with Text
The free PhotoEditor library has included several important features for managing text inside the images using the Java library. You can easily insert text and apply color to the text using a couple of lines of Java code. By default, the library will use the fonts provided in the builder but you can use different fonts with ease. You can also edit the existing available text. The library has also included support for adding Emojis with ease.
Add or Edit Text via Java API
// For adding text, please use the following command
mPhotoEditor.addText(inputText, colorCode);
//How to Edit Text
mPhotoEditor.setOnPhotoEditorListener(new OnPhotoEditorListener() {
@Override
public void onEditTextChangeListener(View rootView, String text, int colorCode) {
}
});