
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
@dkluge/image-editor
Advanced tools
A powerful React image editor component with crop, filter, annotate, and sticker features
A powerful, feature-rich React image editor component with comprehensive editing capabilities.
Experience all features including cropping, filters, annotations, stickers, and more!
npm install @dkluge/image-editor
# or
yarn add @dkluge/image-editor
# or
pnpm add @dkluge/image-editor
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
// 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}
/>
// 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']
]}
/>
// 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))
}}
/>
| 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 |
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
}
select - Selection and manipulation toolcrop - Crop and rotate functionalityfilter - Image filters and effectsannotate - Drawing, shapes, and textsticker - Emoji and image stickersfinetune - Color and exposure adjustmentsframe - Decorative borders and framesimport { 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>
)
}
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.
Contributions are welcome! Please read our contributing guidelines first.
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by the DKLuge Team
FAQs
A powerful React image editor component with crop, filter, annotate, and sticker features
We found that @dkluge/image-editor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.