Gathering detailed insights and metrics for ngx-smart-cropper
Gathering detailed insights and metrics for ngx-smart-cropper
The ngx-smart-cropper component is an angular standalone component that allows users to upload, crop, and resize images with ease.
npm install ngx-smart-cropper
Typescript
Module System
Node Version
NPM Version
66.4
Supply Chain
96.5
Quality
85.3
Maintenance
100
Vulnerability
98.9
License
TypeScript (47.68%)
HTML (29.79%)
CSS (22.53%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
2,048
Last Day
1
Last Week
13
Last Month
143
Last Year
2,048
4 Stars
6 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Jan 14, 2025
Minified
Minified + Gzipped
Latest Version
1.1.9
Package Id
ngx-smart-cropper@1.1.9
Unpacked Size
55.24 kB
Size
9.88 kB
File Count
7
NPM Version
10.9.0
Node Version
22.12.0
Published on
Dec 10, 2024
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-56.7%
13
Compared to previous week
Last Month
7.5%
143
Compared to previous month
Last Year
0%
2,048
Compared to previous year
1
2
The ngx-smart-cropper component is an angular standalone component that allows users to upload, crop, and resize images with ease. It provides intuitive drag-and-resize functionality, grid overlays, and supports various aspect ratios and output formats.
base64
data.1npm install ngx-smart-cropper --save
1<input 2 type="file" 3 accept='image/*' 4 (change)="onFileChange($event)" 5> 6 7<ngx-smart-cropper 8 [imageType]="'jpeg'" 9 [cropX]="50" 10 [cropY]="50" 11 [cropWidth]="400" 12 [cropHeight]="300" 13 [theme]="'mixed'" 14 [imageSource]="imageSource" 15 (imageCroppedEvent)="imageCropped($event)" 16></ngx-smart-cropper> 17 18<img [src]="croppedImage"/>
1import { ImageCropperComponent } from 'ngx-smart-cropper'; 2 3@Component({ 4 standalone: true, 5 imports: [ImageCropperComponent], 6 ... 7}) 8export class MyComponent { 9 10 croppedImage = ''; 11 imageSource: string | null = null; 12 13 onFileChange(event: Event): void { 14 15 const input = event.target as HTMLInputElement; 16 if (!input.files || input.files.length === 0) return; 17 18 const file = input.files[0]; 19 if (file) { 20 const reader = new FileReader(); 21 reader.onload = (e: any) => { 22 this.imageSource = e.target.result; 23 }; 24 reader.readAsDataURL(file); 25 } 26 } 27 28 imageCropped(event: any) { 29 this.croppedImage = event; 30 } 31}
Input | Type | Default | Description |
---|---|---|---|
cropX | number | 50 | Initial crop area x-coordinate. |
cropY | number | 50 | Initial crop area y-coordinate. |
cropWidth | number | 150 | Initial crop width. |
cropHeight | number | 150 | Initial crop height. |
imageType | 'png' | 'jpeg' | 'avif' | 'webp' | 'webp' | File type for the cropped image. |
theme | 'light' | 'dark' | 'mixed' | 'auto' | 'auto' | The theme property automatically adjusts the UI theme between light and dark modes based on the image content. When set to 'auto', it detects the proportion of white pixels in the image and switches to a dark theme if the image contains a high percentage of light pixels, ensuring optimal visibility and contrast. |
whitePixelThreshold | number | 20 | Threshold number for switching between dark and light mode when theme is set to auto. |
Output | Type | Description |
---|---|---|
imageCroppedEvent | EventEmitter<string> | Emits the cropped image data as a base64 string. |
MIT License. See LICENSE
for details.
This project uses beautiful, customizable, and free Tabler Icons for its interface elements. Tabler Icons offer a wide range of icons with clean and modern designs, perfect for enhancing UI/UX in any application. Visit their website to explore more.
Feel free to open issues or contribute enhancements on GitHub.
No vulnerabilities found.
No security vulnerabilities found.