Skip to content

delaroy/AndroidImageEditing

Repository files navigation

Twitter Twitter Twitter JCenter Twitter

## img.ly SDK for Android

img.ly SDK for Android is for creating stunning images with a nice selection of premium filters.

Get it on Google Play

Overview

The img.ly Photo Editor SDK provides a variety of tools and functions for creating photo applications for Android. It is licensed under a proprietary license and intended to be used as better alternative for free software applications such as the GPUImage or similiar libraries. If you are interested in our SDK, please contact us.

SDK Core

ACS Component
A generic Android Camera Stack library which is based on the android.hardware.Camera API. Supports front and rear cam, HDR, flash modes and much more.

SDK Component
The img.ly core library for Android. Containing the OpenGL and toolset implementation.

UI Component
The default UI components consisting of LivePreview and Editor Activity.

PLUGIN Components
At the momment not implemented, it is for future use. For Example to embedding you Google Analytics.

Dependencies

No external non Google libraries needed or used by the SDK.

  • com.android.support:recyclerview-v7:23.2.0'
  • com.android.support:support-annotations:23.2.0'

Features

  • Android API Level 15+. Covers nearly 95% of all Android devices.
  • Default UI for camera preview and editing. Based on Intents and Activities.
  • Fast image export. Even with large images or slow devices the export is done in adequate time with background processing.
  • Generic camera support. Integrated and featureful on the most Android phones.
  • Crop, Rotate, Stickers, Text Placement, and Colorize. All essential photo editing functions wrapped into a simple, beautiful and customizable UI.
  • 57 Stunning filters which are builtin and work out of the box.
  • No native code. Our backend is Renderscript based with highlevel OpenGL support, therefore we dodge all the nasty native library problems other frameworks face.
  • Tablet support. Works great on tablets.
  • Photoshop LUT. Design color filters in Photoshop! With this feature it is possible to generate LUT (Look Up Table) color filters easily from different photo editing tools. Export and integrate them in minutes!
  • Live Preview up to 21mpx. Filters can be previewed in high quality realtime on full camera resolution.
  • Low memory footprint even with high resolution images.
  • Extensible and customizable toolset interface. Add your own customized filters with Renderscript and modify tool properties yourself.

License

img.ly SDK for Android is a licensed library which can be used for different purposes.
Please see:

LICENSE.PROPIETARY for PROPIETARY usage.

Author & Contact

© 9elements GmbH
Email
Homepage
Follow us on Twitter

Installation

Require a minimum deployment target of Android API 15 (4.0.4) and Device with HardwareLayer (for LivePreview) and LargeHeap Support (To operate and export large images)

1. Import the img.ly SDK into your project with jcenter like this.
apply plugin: 'com.android.application'
...

repositories {
    ...
    jcenter()
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    minSdkVersion 15
    ...

    defaultConfig {
        ...
        renderscriptTargetApi 20
        renderscriptSupportModeEnabled true
    }
    ...
}


dependencies {

    compile 'ly.img.android:photo-editor-sdk:1.0.10'
    ...
}

Do not forget to add "renderscriptSupportModeEnabled true" and "renderscriptTargetApi 20"!
And please use the latest jCenter Version

JCenter
2. Initialize SDK in an Application class.
<?xml version="1.0" encodinAg="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.mymodule.app" >

    <application
        android:name=".Application"
        ... >

        ...
    </application>

</manifest>
public class Application extends android.app.Application {
    @Override
    public void onCreate() {
        super.onCreate();

        ImgLySdk.init(this);
    }
}
3.1. Start img.ly SDK default UI.
public class MainActivity extends Activity implements PermissionRequest.Response{

    public static int CAMERA_PREVIEW_RESULT = 1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        new CameraPreviewIntent(this)
                .setExportDir(CameraPreviewIntent.Directory.DCIM, "ImgLyExample")
                .setExportPrefix("example_")
                .setEditorIntent(
                        new PhotoEditorIntent(this)
                        .setExportDir(PhotoEditorIntent.Directory.DCIM, "ImgLyExample")
                        .setExportPrefix("result_")
                        .destroySourceAfterSave(true)
                )
                .startActivityForResult(CAMERA_PREVIEW_RESULT);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, android.content.Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK && requestCode == CAMERA_PREVIEW_RESULT) {
            String path = data.getStringExtra(CameraPreviewActivity.RESULT_IMAGE_PATH);

            Toast.makeText(this, "Image Save on: " + path, Toast.LENGTH_LONG).show();

        }
    }
    
    //Important for Android 6.0 permisstion request, don't forget this!
    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        PermissionRequest.onRequestPermissionsResult(requestCode, permissions, grantResults);
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }

    @Override
    public void permissionGranted() {

    }

    @Override
    public void permissionDenied() { 
        //The Permission whas rejected by the user, so the Editor was not opened because it can not save the result Image. 
        //TODO for you: Show a Hint to the User
    }
}

Do not forget to delegate the onRequestPermissionsResult to PermissionRequest.onRequestPermissionsResult. Apart from that it will not work on Android 6.0 and above

3.1. Start Camera Preview Activity with editor backend.
// Camera activity intent with customized editor access.
        new CameraPreviewIntent(this)
        .setExportPrefix("example_")
        .setEditorIntent(
            new PhotoEditorIntent(this)
            .setExportDir(PhotoEditorIntent.Directory.DCIM, "ImgLyExample")
            .setExportPrefix("result_")
            .destroySourceAfterSave(true)
        )
        .setExportDir(CameraPreviewIntent.Directory.DCIM, "ImgLyExample")
        .startActivityForResult(CAMERA_PREVIEW_RESULT);
3.2. Start Editor Activity standalone.
// Editor activity intent.
        new PhotoEditorIntent(this)
        .setSourceImagePath(imagePath)
        .setExportDir(PhotoEditorIntent.Directory.DCIM, "ImgLyExample")
        .setExportPrefix("result_")
        .destroySourceAfterSave(true)
        .startActivityForResult(CAMERA_PREVIEW_RESULT);
4. Customize SDK tools for your own Android App.
// Toolset modifications can be done easily inside the Application class.
public class Application extends android.app.Application {
    @Override
    public void onCreate() {
        super.onCreate();

        ImgLySdk.init(this);

        // Step1 get current configuration.
        ArrayList<CropAspectConfig> cropConfig = PhotoEditorSdkConfig.getCropConfig();

        // Step2 clear it.
        cropConfig.clear();

        // Step3 add the needed properties and filters for different tools.
        cropConfig.add(new CropAspectConfig(R.string.imgly_crop_name_custom, R.drawable.icon_crop_custom, -1));
        cropConfig.add(new CropAspectConfig(R.string.imgly_crop_name_4_3, R.drawable.icon_crop_4_3, 4/3));

        // Step4 done!

        // More examples:
        ArrayList<ColorFilter> colorFilterConfig = PhotoEditorSdkConfig.getFilterConfig();

        colorFilterConfig.clear();

        colorFilterConfig.add(new NoneColorFilter());
        colorFilterConfig.add(new ColorFilterBleached());
        colorFilterConfig.add(new ColorFilterChest());

        ArrayList<ImageStickerConfig> stickers = PhotoEditorSdkConfig.getStickerConfig();

        stickers.clear();

    }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages