The 2017 Ionic Developer Survey Results are in!

Crop

Improve this doc

Crops images

Repo: https://github.com/jeduan/cordova-plugin-crop

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-crop
    $ npm install --save @ionic-native/crop
    
  2. Add this plugin to your app's module

Supported platforms

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
options

Returns: Promise<string> Returns a promise that resolves with the new image path, or rejects if failed to crop.

API

Native

General