npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@one-crop-image/angular

v1.0.0

Published

A powerful Angular standalone image cropping component with rotation, mirroring, zoom, filters, aspect-ratio presets, undo/redo history, drag-and-drop upload, and accessible controls. Exports cropped images as PNG, JPEG, or WebP with size constraints.

Downloads

23

Readme

@one-crop-image/angular

A powerful, accessible image-cropping component for Angular — rotation, mirroring, zoom, filters, aspect-ratio presets, undo/redo history, and drag-and-drop upload, with export to PNG, JPEG, or WebP.

npm version license: MIT Angular

Features

  • ✂️ Precise cropping — draggable, resizable crop region with rectangle or circle shape
  • 🔄 Rotate & mirror — 90° steps or free rotation at any angle, horizontal/vertical flip
  • 🔍 Smooth zoom — configurable range and step, buttons and mouse-wheel support
  • 📐 Aspect-ratio presets — 1:1, 4:3, 16:9 and more, extensible with custom presets
  • 🎨 Live filters — brightness, contrast, and saturation rendered in real time
  • ↩️ Undo / redo — full history of every transform, exposed through events
  • 📏 Composition guides — rule of thirds, golden ratio, or diagonal overlays
  • 📁 Drag & drop — drop a file onto the stage or use the built-in file picker
  • 📦 Flexible export — PNG / JPEG / WebP as File, Blob, base64, or canvas, with size limits
  • ♿ Accessible — focus management via Angular CDK and keyboard operability
  • 🧩 Standalone-first — works as a standalone component or via OneImageCropModule

Installation

npm install @one-crop-image/angular

Peer dependencies: @angular/core, @angular/common, @angular/forms, @angular/cdk (>= 19) and rxjs.

npm install @angular/cdk

Quick start

Standalone component (recommended)

import { Component } from '@angular/core';
import { OneImageCropComponent } from '@one-crop-image/angular';

@Component({
  selector: 'app-avatar-upload',
  standalone: true,
  imports: [OneImageCropComponent],
  template: `
    <one-image-crop
      [enableRotate]="true"
      [enableZoom]="true"
      [outputFormat]="'image/jpeg'"
      [outputQuality]="0.9"
      (onImageCroppedAction)="onCropped($event)">
    </one-image-crop>
  `
})
export class AvatarUploadComponent {
  onCropped(file: File): void {
    // Upload or preview the cropped file
  }
}

NgModule with global defaults

import { NgModule } from '@angular/core';
import { OneImageCropModule } from '@one-crop-image/angular';

@NgModule({
  imports: [
    OneImageCropModule.forRoot({
      outputFormat: 'image/jpeg',
      outputQuality: 0.9,
      guidelineType: 'rule-of-thirds'
    })
  ]
})
export class AppModule {}

Bulk configuration

Every option can also be passed at once through the config input; individual inputs take precedence.

<one-image-crop
  [config]="{
    enableRotate: true,
    enableFilters: true,
    enableHistory: true,
    cropShape: 'circle',
    outputFormat: 'image/webp',
    maxOutputWidth: 1024,
    maxOutputHeight: 1024
  }"
  (onImageCroppedAction)="onCropped($event)"
  (onHistoryChange)="onHistoryChange($event)">
</one-image-crop>

API

Inputs

| Input | Type | Default | Description | | --- | --- | --- | --- | | config | Partial<ImageCropConfig> | {} | Bulk configuration object; individual inputs override it. | | imageUrl | string \| null | null | Load an image from a URL instead of the file picker. | | enableRotate | boolean | true | Show 90° rotation controls. | | enableFreeRotation | boolean | true | Allow rotation by arbitrary angles. | | enableMirror | boolean | true | Show horizontal / vertical flip controls. | | enableZoom | boolean | true | Allow zooming with buttons and mouse wheel. | | enableFilters | boolean | false | Show brightness, contrast, and saturation filters. | | enablePresets | boolean | false | Show aspect-ratio preset buttons. | | enableHistory | boolean | true | Enable undo / redo history. | | enableShortcuts | boolean | false | Enable keyboard shortcuts. | | enableAutoCrop | boolean | false | Detect and suggest a crop region automatically. | | disableDragDrop | boolean | false | Turn off drag-and-drop file upload. | | disable | boolean | false | Disable the whole component. | | showGuidelines | boolean | true | Overlay composition guidelines on the crop area. | | guidelineType | 'rule-of-thirds' \| 'golden-ratio' \| 'diagonal' | 'rule-of-thirds' | Which guideline pattern to draw. | | cropShape | 'rectangle' \| 'circle' | 'rectangle' | Shape of the crop selection. | | minZoom / maxZoom / zoomStep | number | 1 / 5 / 0.08 | Zoom range and step size. | | outputFormat | 'image/png' \| 'image/jpeg' \| 'image/webp' | 'image/png' | MIME type of the exported image. | | outputQuality | number | 0.92 | Encoder quality for JPEG / WebP (0–1). | | outputWidth / outputHeight | number | — | Force exact output dimensions. | | maxOutputWidth / maxOutputHeight | number | — | Cap output dimensions while keeping aspect ratio. | | maxBytes | number | 1048576 | Maximum exported file size in bytes. | | emitType | 'file' \| 'base64' \| 'both' | 'file' | Which output events are emitted after cropping. |

Outputs

| Output | Payload | Description | | --- | --- | --- | | onImageCroppedAction | File | Fires with the cropped image as a File. | | onImageCroppedBase64 | string | Fires with the cropped image as a base64 data URL. | | onImageCroppedBlob | Blob | Fires with the cropped image as a Blob. | | onImageCroppedCanvas | HTMLCanvasElement | Fires with the canvas holding the cropped image. | | onHistoryChange | { canUndo: boolean; canRedo: boolean } | Fires when undo / redo availability changes. | | onFiltersChange | FilterState | Fires when filter values change. | | onMultipleCropsExport | { crops: File[]; metadata: any[] } | Fires when multiple crop regions are exported. |

Services & types

Beyond the component, the package exports the underlying services (ExportService, ImageTransformService, HistoryService, CropCalculationService, and more), the CropEventBus, and all TypeScript interfaces (ImageCropConfig, CropRect, ImageState, …) for advanced integrations.

Compatibility

| @one-crop-image/angular | Angular | | --- | --- | | 1.x | >= 19 |

Contributing

Issues and pull requests are welcome at the GitHub repository.

License

MIT © Phanith Nhoem