UNPKG

993 BTypeScriptView Raw
1import { IonicNativePlugin } from '@ionic-native/core';
2export interface CropOptions {
3 quality?: number;
4 targetHeight?: number;
5 targetWidth?: number;
6}
7/**
8 * @name Crop
9 * @description Crops images
10 * @usage
11 * ```typescript
12 * import { Crop } from '@ionic-native/crop/ngx';
13 *
14 * constructor(private crop: Crop) { }
15 *
16 * ...
17 *
18 * this.crop.crop('path/to/image.jpg', {quality: 75})
19 * .then(
20 * newImage => console.log('new image path is: ' + newImage),
21 * error => console.error('Error cropping image', error)
22 * );
23 * ```
24 * @interfaces
25 * CropOptions
26 */
27export declare class CropOriginal extends IonicNativePlugin {
28 /**
29 * Crops an image
30 * @param {string} pathToImage
31 * @param {CropOptions} [options]
32 * @returns {Promise<string>} Returns a promise that resolves with the new image path, or rejects if failed to crop.
33 */
34 crop(pathToImage: string, options?: CropOptions): Promise<string>;
35}
36
37export declare const Crop: CropOriginal;
\No newline at end of file