Giter VIP home page Giter VIP logo

croppernocropper's Introduction

Cropper - NoCropper

This is a lightweight Image Cropper for Android which also supports no-crop feature.

Project Page Blogpost

Here's a short gif showing how it works.

Demo

And, here's a bit longer YouTube Video

CropperView

It's a FrameLayout which contains a view for Grid and an imageview. This project supports only square cropping. CropperView contains some basic methods like setImageBitmap(), setMaxZoom(), setMinZoom(), etc which are forwarded to CropperImageView.

How To Install

Maven

repositories {
    maven {
        url  "http://dl.bintray.com/jayrambhia/maven"
    }
}

JCenter

repositories {
    jcenter()
}

Dependency

dependencies {
    compile 'com.fenchtose.nocropper:nocropper:0.1.7'
}

CropperImageView

It's a square ImageView which acts as the cropper. It tries to keep the image in the range of max and min zoom. It automatically adjusts the position of the image, if it's zoomed out.

How To Use:

<com.fenchtose.nocropper.CropperView
    android:background="#ff282828"
    android:id="@+id/cropper_view"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    app:grid_opacity="0.8"
    app:grid_thickness="0.8dp"
    app:grid_color="@color/colorAccent"
    app:padding_color="#ff282828"/>

And that's it. CropperView is ready to be used anywhere in the app. No dependencies.

Useful Methods:

  • setMaxZoom(float zoom) set Maximum zoom
  • setMinZoom(float zoom) set Minimum zoom
  • setImageBitmap(Bitmap bm) set Bitmap
  • replaceBitmap(Bitmap bm) Replace Bitmap without changing the image matrix
  • setGestureEnabled(boolean enabled) Enable/Disable Cropper gestures
  • setDebug(boolean debug) - Debugging mode
  • cropToCenter() - Set Image in the center with square crop view
  • fitToCenter() - Fit Image in the center (no cropping view)
  • setPaddingColor(int color) - Set Color of square image padding
  • setMakeSquare(boolean status) - If you want to add padding in the cropped image (if cropped image is not square)
  • isMakeSquare() - Check if cropper will give a square image or not
  • getCroppedBitmap() - Get Cropped Bitmap
  • release() - Remove and Recycle Bitmap

Styleables

  • grid_color - Color of the grid
  • grid_thickness - Thickness of grid lines
  • grid_opacity - Opacity of grid lines
  • padding_color - Color of the image padding
  • add_padding_to_make_square - boolean

Licenses and Release History

CHANGELOG

NoCropper binaries and source code can be used according to the Apache License, Version 2.0.

croppernocropper's People

Contributors

jayrambhia avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.