Crop
Crops images
Repo: https://github.com/jeduan/cordova-plugin-crop
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-plugin-crop $ npm install --save @ionic-native/crop@4
- Add this plugin to your app's module
Supported platforms
- Android
- iOS
Usage
import { Crop } from '@ionic-native/crop';
constructor(private crop: Crop) { }
...
this.crop.crop('path/to/image.jpg', {quality: 75})
.then(
newImage => console.log('new image path is: ' + newImage),
error => console.error('Error cropping image', error)
);
Instance Members
crop(pathToImage, options)
Crops an image
Param | Type | Details |
---|---|---|
pathToImage |
string
|
|
options |
CropOptions
|
Optional |
Returns: Promise<string>
Returns a promise that resolves with the new image path, or rejects if failed to crop.
CropOptions
Param | Type | Details |
---|---|---|
quality |
number
|
(optional) |
targetHeight |
number
|
(optional) |
targetWidth |
number
|
(optional) |