1.0.4 • Published 6 years ago

ngx-image-crop v1.0.4

Weekly downloads
7
License
MIT
Repository
github
Last release
6 years ago

ImageCrop CI status

Ngx image cropper module.

Installation

npm install ngx-image-crop

app.module.ts

import { ImageCropModule } from 'ngx-image-crop'; 

... 
imports: [
    ...
    ImageCropModule
    ...
] 
... 

Usage

import { ImageCropService } from 'ngx-image-crop';

...
constructor(private _imageCropService: ImageCropService) { }
...

...
const dataUrl = this._imageCropService(image, {
    x: <cropX>,
    y: <cropY>,
    width: <cropWidth>,
    height: <cropHeight>,
    quality: <quality-(between 0 - 1)>,
    angle: <rotation angle in degree>
});
...

Configuration

/**
* Iamge crop options interface.
*/
export interface ImageCropConfig {
    /**
    * 'x' coordinate of crop area on source image.
    */
    x?: number;
    /**
    * 'y' coordinate of crop area on source image.
    */
    y?: number;
    /**
    * Crop Width.
    */
    width?: number;
    /**
    * Crop height.
    */
    height?: number;
    /**
    * Rotation angle.
    */
    angle?: number;
    /**
    * Output image quality.
    */
    quality?: number;
}

License

MIT

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago