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

@dkluge/image-editor

v1.0.16

Published

A powerful React image editor component with crop, filter, annotate, and sticker features

Readme

@dkluge/image-editor

npm version License: MIT TypeScript

A powerful, feature-rich React image editor component with comprehensive editing capabilities.

🎯 Live Demo

Try it now →

Experience all features including cropping, filters, annotations, stickers, and more!

✨ Features

  • 🖼️ Image Editing: Crop, rotate, flip, and resize images
  • 🎨 Filters: 15+ built-in filters (vintage, dramatic, artistic, etc.)
  • ✏️ Annotations: Draw, add shapes, text, and arrows
  • 🏷️ Stickers: Emoji stickers and custom image uploads
  • 🎛️ Fine-tuning: Brightness, contrast, saturation, exposure, gamma, vignette
  • 🖼️ Frames: 10+ decorative frame styles
  • 🌍 Internationalization: Built-in support for multiple languages
  • 📱 Responsive: Optimized for desktop and mobile devices
  • 🔧 Customizable: Configurable tools, presets, and styling
  • Performance: Optimized canvas rendering and memory management
  • 🎯 TypeScript: Full type safety and IntelliSense support

📦 Installation

npm install @dkluge/image-editor
# or
yarn add @dkluge/image-editor
# or
pnpm add @dkluge/image-editor

🚀 Quick Start

import React from 'react'
import { DkImageEditor } from '@dkluge/image-editor'

function App() {
  const handleSave = (result) => {
    console.log('Saved image:', result)
    // result.src - Blob URL of edited image
    // result.dest - File object for download
    // result.imageState - Current editor state
  }

  const handleClose = () => {
    console.log('Editor closed')
  }

  return (
    <DkImageEditor
      src="https://example.com/image.jpg" // URL, File, or Blob
      language="en" // 'en' | 'zh' | custom
      onSave={handleSave}
      onClose={handleClose}
      utils={['crop', 'filter', 'annotate', 'sticker', 'finetune', 'frame']}
    />
  )
}

export default App

🌍 Internationalization

// Built-in language support
<DkImageEditor language="zh" /> // Chinese
<DkImageEditor language="en" /> // English

// Custom translations - 只需要覆盖特定的键值,其他会使用默认翻译
const customTranslations = {
  en: { 
    'header.upload': 'Choose Photo',  // 覆盖默认翻译
    'header.download': 'Export Image' // 覆盖默认翻译
    // 其他键值会使用默认的英文翻译
  },
  zh: { 
    'header.upload': '选择照片'  // 覆盖默认中文翻译
    // 其他键值会使用默认的中文翻译
  },
  ja: { 
    // 添加新语言支持
    'header.upload': '画像をアップロード',
    'header.download': 'ダウンロード',
    'tool.crop': 'クロップ'
  }
}

<DkImageEditor 
  language="ja" 
  translations={customTranslations} 
/>

🎨 Customization Examples

// Custom tool selection
<DkImageEditor
  utils={['crop', 'filter', 'annotate']} // Only show specific tools
  cropSelectPresetOptions={[
    [undefined, 'Original'],
    [1, 'Square'],
    [16/9, 'Widescreen'],
    [9/16, 'Portrait']
  ]}
  filterOptions={[
    ['vintage', 'Vintage'],
    ['dramatic', 'Dramatic'],
    ['vivid', 'Vivid']
  ]}
/>

🔄 State Persistence

// Save editing state for later restoration
const [savedState, setSavedState] = useState(null)

<DkImageEditor
  src="image.jpg"
  initialState={savedState} // Restore previous editing session
  onConfirm={(result) => {
    // Save state for next time
    setSavedState(result.imageState)
    localStorage.setItem('editorState', JSON.stringify(result.imageState))
  }}
/>

📚 API Reference

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | src | string \| File \| Blob | Required | Image source (URL, File object, or Blob) | | initialState | EditorState | - | Restore previous editing state | | onSave | (result: SaveResult) => void | Required | Callback when user saves the edited image | | onClose | () => void | Required | Callback when user closes the editor | | onConfirm | (result: ConfirmResult) => void | - | Callback with canvas and state data | | language | 'en' \| 'zh' \| string | 'en' | Interface language | | translations | Translations | - | Custom translation object | | className | string | '' | Additional CSS class name | | utils | string[] | ['select', 'crop', 'filter', 'annotate', 'sticker', 'finetune', 'frame'] | Available editing tools | | cropSelectPresetOptions | Array<[number \| undefined, string]> | Default presets | Custom crop aspect ratio presets | | annotateTools | Array<[string, string]> | Default tools | Custom annotation tools | | filterOptions | Array<[string, string]> | Default filters | Custom filter options | | finetuneOptions | Array<[string, string]> | Default options | Custom fine-tune controls | | showCloseButton | boolean | true | Show/hide close button | | showDownloadButton | boolean | true | Show/hide download button |

Result Objects

interface SaveResult {
  src: string        // Blob URL of the edited image
  dest: File         // File object ready for download/upload
  imageState: EditorState // Complete editor state for restoration
}

interface ConfirmResult {
  src: string        // Blob URL of the edited image
  dest: File         // File object ready for download/upload
  imageState: EditorState // Complete editor state for restoration
  canvas: HTMLCanvasElement // Raw canvas element
}

Available Tools

  • select - Selection and manipulation tool
  • crop - Crop and rotate functionality
  • filter - Image filters and effects
  • annotate - Drawing, shapes, and text
  • sticker - Emoji and image stickers
  • finetune - Color and exposure adjustments
  • frame - Decorative borders and frames

🎯 Examples

Basic Implementation

import { DkImageEditor } from '@dkluge/image-editor'

function MyEditor() {
  return (
    <div style={{ width: '100vw', height: '100vh' }}>
      <DkImageEditor
        src="/path/to/image.jpg"
        onSave={(result) => {
          // Download the edited image
          const link = document.createElement('a')
          link.href = result.src
          link.download = 'edited-image.png'
          link.click()
        }}
        onClose={() => console.log('Editor closed')}
      />
    </div>
  )
}

Advanced Usage with State Persistence

function AdvancedEditor() {
  const [editorState, setEditorState] = useState(null)
  
  return (
    <DkImageEditor
      src="image.jpg"
      initialState={editorState}
      utils={['crop', 'filter', 'annotate']} // Custom tools
      language="zh" // Chinese interface
      onConfirm={(result) => {
        setEditorState(result.imageState) // Save for restoration
        // Process result.canvas or result.dest
      }}
    />
  )
}

Check out the example directory for more comprehensive examples.

🤝 Contributing

Contributions are welcome! Please read our contributing guidelines first.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built with React and TypeScript
  • Canvas-based image processing
  • Inspired by modern image editing tools

Made with ❤️ by the DKLuge Team