Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/takusemba/cropme
Extremely Smooth and Easy Cropping library for you
https://github.com/takusemba/cropme
android android-library crop-image cropper cropping image imagecropper springanimation
Last synced: 4 days ago
JSON representation
Extremely Smooth and Easy Cropping library for you
- Host: GitHub
- URL: https://github.com/takusemba/cropme
- Owner: TakuSemba
- License: apache-2.0
- Created: 2017-09-11T12:15:56.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-02T17:36:36.000Z (7 months ago)
- Last Synced: 2025-01-26T08:08:48.520Z (11 days ago)
- Topics: android, android-library, crop-image, cropper, cropping, image, imagecropper, springanimation
- Language: Kotlin
- Size: 32.5 MB
- Stars: 423
- Watchers: 7
- Forks: 73
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CropMe
## Gradle
```groovy
dependencies {
implementation 'com.github.takusemba:cropme:x.x.x'
}```
## Usage
![Build Status](https://app.bitrise.io/app/1c8ba06a60a25360/status.svg?token=qkQNVMnD0E6PXXhcorNyuQ&branch=master)
![Download](https://api.bintray.com/packages/takusemba/maven/cropme/images/download.svg)
![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)
![API](https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat)This is an Android library for cropping images. Move images smoothly, and crop images precisely.
### Use CropView in your xml file.
```xml
```
### Set your image
```kt
cropView.setUri(uri);
// or
cropView.setBitmap(bitmap)
```### Crop it!
```kt
cropLayout.addOnCropListener(object : OnCropListener {
override fun onSuccess(bitmap: Bitmap) {
// do somethhing with bitmap.
}override fun onFailure(e: Exception) {
// do error handling.
}
})
cropView.isOffFrame() // optionally check if the image is off the frame.cropView.crop() // crop image
```
## Attributes
| attribute | description | default |
|:---|:---|:---|
| cropme_frame_width_percent | width of croppling frame | 80% |
| cropme_frame_height_percent | height of croppling frame | 80% |
| cropme_max_scale | maximum scale while cropping | 2.0 |
| cropme_with_border | if borders are shown while cropping | true |
| cropme_background_alpha | background alpha out side of cropping area | 80% |
| cropme_overlay_shape | shape of croppling frame | rectangle / circle / custom |
| cropme_custom_shape_layout | custom layout for custom shape | @layout/custom_layout |
## Custom Overlay
If you want to show a custom overlay, you can customize the Overlay by extending CropOverlay.
You can see more detail in [app](https://github.com/TakuSemba/CropMe/tree/master/app) module.
```java
class CustomCropOverlay @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
cropOverlayAttrs: AttributeSet? = attrs
) : CropOverlay(context, attrs, defStyleAttr, cropOverlayAttrs) {override fun drawBackground(canvas: Canvas, paint: Paint) {
// draw background
}override fun drawCrop(canvas: Canvas, paint: Paint) {
// draw croppling frame
}override fun drawBorder(canvas: Canvas, paint: Paint) {
// draw borders
}
}
```## Sample
Clone this repo and check out the [app](https://github.com/TakuSemba/CropMe/tree/master/app) module.## Author
* **Taku Semba**
* **Github** - (https://github.com/takusemba)
* **Twitter** - (https://twitter.com/takusemba)
* **Facebook** - (https://www.facebook.com/takusemba)## Licence
```
Copyright 2017 Taku Semba.Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```