Implementing Syncfusion React Image Editor
The Syncfusion React Image Editor is a comprehensive, feature-rich component for editing images directly in your React applications. It provides an intuitive interface with powerful tools for transformations, annotations, effects, and more.
Component Overview
The Image Editor combines a canvas-based editing environment with a comprehensive toolbar and contextual tools. It supports:
- Multiple Input Sources: Files, URLs, base64, blobs, file managers, treeviews
- Rich Annotation Support: Text (with styling), shapes, freehand drawings, watermarks
- Professional Effects: Filters and fine-tuning controls
- Advanced Operations: Z-order management, redaction, frame decoration
- Accessibility First: Full keyboard navigation, WCAG compliance, RTL support, 120+ localization keys
- Flexible Integration: Standalone or within dialogs, with customizable toolbars
Documentation and Navigation Guide
🔹 API Reference
📄 Read: references/api.md
- Complete API documentation with all properties, methods, and events
- Properties overview (core, toolbar, settings)
- Methods for image operations, transformations, annotations
- Events for lifecycle, interactions, effects, and toolbars
- Enums and type definitions (ArrowheadType, FrameType, RedactType, etc.)
- Complete working examples with verified method signatures
Getting Started
📄 Read: references/getting-started.md
- Installation with Vite and create-react-app
- CSS imports and theme setup
- Basic component initialization
- Setting width, height, and initial rendering
Opening and Saving Images
📄 Read: references/opening-saving-images.md
- Open from file paths, URLs, base64 strings, blobs
- Open from file uploader, file manager, and treeview
- Save/export as PNG, JPEG, SVG, WEBP
- Image dimensions and aspect ratio control
- File opened, saving, and lifecycle events
Selection and Cropping
📄 Read: references/selection-cropping.md
- Insert custom, square, and circle selections
- Crop with aspect ratios (2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 5:7, 7:5, 9:16, 16:9)
- Crop method and selection events
- Maintain original image size during cropping
- Lock selection area during resizing
Transform: Rotate, Flip, and Straighten
📄 Read: references/transform-rotate-flip.md
- Rotate clockwise/counter-clockwise by degrees
- Flip horizontally and vertically
- Straighten images with fine degree adjustments (-45° to +45°)
- Transform annotations along with image
- Rotating and flipping events
Zoom and Pan Operations
📄 Read: references/zooming-panning.md
- Zoom in/out with configurable min/max factors
- Pan when zoomed or during cropping
- Zoom triggers (toolbar, pinch, mouse wheel, keyboard)
- Zooming and panning events
- Zoom point calculations
Text Annotations
📄 Read: references/text-annotations.md
- Add text with position, content, and font settings
- Text styling (bold, italic, underline, strikethrough)
- Font families, sizes, and colors
- Multiline text with newline characters
- Delete text annotations
- Customize font color via shapeChanging event
Freehand Drawing
📄 Read: references/freehand-drawing.md
- Enable/disable freehand drawing mode
- Customize stroke width and color
- Delete freehand annotations
- Adjust stroke during drawing via shapeChanging event
Shape Annotations
📄 Read: references/shape-annotations.md
- Draw rectangles, ellipses, lines, arrows, and paths
- Customize shapes with stroke color, stroke width, and fill color
- Rotate shapes with degree parameter
- Delete shape annotations
- Customize default stroke colors
- Shape changing and customization events
Image Annotations
📄 Read: references/image-annotations.md
- Add images or icons as annotations
- Control position, size, rotation, and opacity
- Aspect ratio preservation
- Watermarks and decorative elements
Filters
📄 Read: references/filters.md
- Apply predefined filters (Chrome, Cold, Warm, Grayscale, Sepia, Invert)
- Image filtering event
- Reset filter to original
Fine-Tuning
📄 Read: references/finetune.md
- Adjust brightness, contrast, saturation
- Control hue, exposure, blur, opacity
- Finetune value changing events
- Real-time adjustments with sliders
Undo and Redo
📄 Read: references/undo-redo.md
- Undo/redo operations with 16-step history
- Keyboard shortcuts (Ctrl+Z, Ctrl+Y)
- History management and limits
Toolbar Customization
📄 Read: references/toolbar-customization.md
- Built-in toolbar items (20+ default tools)
- Add, remove, enable, disable toolbar items
- Custom toolbar items with event handlers
- Contextual toolbar for annotations
- Toolbar templates for complete customization
- Toolbar created and item clicked events
Quick Access Toolbar
📄 Read: references/quick-access-toolbar.md
- Quick access toolbar for annotations
- Show/hide quick access toolbar
- Add custom items to quick access toolbar
- Quick access toolbar open event
Resize Image
📄 Read: references/resize-image.md
- Resize with or without aspect ratio
- Width and height parameters
- Resizing event with before/after dimensions
Frame Decoration
📄 Read: references/frame-decoration.md
- Apply frames (Mat, Bevel, Line, Inset, Hook)
- Customize frame color, size, and line style
- Frame changing event
Z-Order Layering
📄 Read: references/z-order-layering.md
- Bring forward/send backward annotations
- Bring to front/send to back
- Manage annotation layer order
Redact Sensitive Information
📄 Read: references/redact-sensitive-info.md
- Blur sensitive areas
- Pixelate sensitive information
- Redact CRUD operations (select, update, delete, get)
- Privacy and compliance
Accessibility and Localization
📄 Read: references/accessibility-localization.md
- WCAG 2.2, Section 508 compliance
- Screen reader support
- Keyboard shortcuts (Ctrl+Z, Ctrl+S, Ctrl+O, Delete, Enter, Escape)
- RTL language support
- Localization with 120+ locale keys
Image Restrictions and Validation
📄 Read: references/image-restrictions-validation.md
- Allowed file extensions (.jpg, .png, .svg, .webp, .bmp)
- Min and max file size restrictions
- File validation and error alerts
Clear Image
📄 Read: references/clear-image.md
- Clear editor state
- Dialog reuse patterns
- Remove previously loaded images
Fit to Width and Height
📄 Read: references/fit-width-height.md
- Fit image to editor container width
- Fit image to editor container height
- Zoom calculations for perfect fit
Render in Dialog
📄 Read: references/render-in-dialog.md
- Render Image Editor within Dialog component
- Content template integration
- Dialog show/hide patterns
Reset Image
📄 Read: references/reset-image.md
- Reset all modifications to original state
- Restore unmodified version
- Clear annotations and effects
Quick Start Example
import { ImageEditorComponent } from '@syncfusion/ej2-react-image-editor';
import React from 'react';
function App() {
let imgObj: ImageEditorComponent;
function imageEditorCreated(): void {
imgObj.open('https://ej2.syncfusion.com/react/documentation/image-editor/images/bridge.jpeg');
}
return (
<div>
<ImageEditorComponent
ref={(img) => { imgObj = img }}
width="550px"
height="350px"
created={imageEditorCreated}
/>
</div>
);
}
export default App;
Common Patterns
Pattern 1: Open + Edit + Save Workflow
- Open image via
open() method
- Apply transformations, annotations, or effects
- Use
export() to save as PNG/JPEG/SVG/WEBP
- Optionally convert to base64 or blob for backend storage
Pattern 2: Responsive Toolbar
- Define custom toolbar items in
toolbar property
- Handle clicks via
toolbarItemClicked event
- Execute methods like
rotate(), zoom(), drawText() based on clicked item
- Update contextual toolbar via
toolbarUpdating event
Pattern 3: Annotation Workflow
- Enable annotation mode (freehand, text, shape)
- Customize via
shapeChanging event (color, stroke, font)
- Delete via
deleteShape() with shape ID
- Manage layers via z-order methods
Pattern 4: Dialog Integration
- Render Image Editor in Dialog's
content template
- Load image when dialog opens via
fileOpened event
- Call
clearImage() before closing dialog
- Retrieve edited image data via
export() or getImageData()
Pattern 5: Filter + Finetune Pipeline
- Apply filter via
applyImageFilter()
- Fine-tune via
finetuneImage() (brightness, contrast, etc.)
- Listen to
imageFiltering and finetuneValueChanging events
- Combine effects for professional results
Key Properties
| Property |
Type |
Purpose |
width |
string |
Editor canvas width (e.g., "550px", "100%") |
height |
string |
Editor canvas height (e.g., "350px", "100%") |
toolbar |
array |
Customize toolbar items and visibility |
fontFamily |
object |
Add custom font families |
uploadSettings |
object |
Configure file restrictions (extensions, size) |
zoomSettings |
object |
Set min/max zoom factors |
showQuickAccessToolbar |
boolean |
Show/hide quick access toolbar |
locale |
string |
Set localization (e.g., 'de-DE') |
Key Events
| Event |
Trigger |
Use Case |
created |
Component initialized |
Load image on startup |
fileOpened |
Image loaded |
Add watermarks, apply defaults |
beforeSave |
Before export |
Validate, add metadata |
cropping |
During crop |
Prevent scaling, lock dimensions |
zooming |
During zoom |
Validate zoom level |
rotating |
During rotate |
Track rotation angle |
shapeChanging |
Annotation modified |
Customize stroke, font |
toolbarUpdating |
Toolbar rendered |
Add/remove contextual items |
Supported File Formats
Open: PNG, JPEG, JPG, SVG, WEBP, BMP (local, URL, base64, blob)
Save/Export: PNG, JPEG, SVG, WEBP
Next Steps
- Start with getting-started.md for setup
- Explore opening-saving-images.md to understand data flow
- Check specific features in their dedicated reference files
- Use accessibility-localization.md for multi-language support
1---
2name: syncfusion-react-image-editor
3description: Master Syncfusion React Image Editor for comprehensive image editing. Use this when users need to edit images, add annotations, apply filters, manage layers, or implement image editing features. Supports multiple formats (PNG, JPEG, SVG, WEBP, BMP), annotations (text, shapes, freehand, images), effects (filters, finetune), and accessibility features.
4metadata:
5 author: "Syncfusion Inc"
6 version: "34.1.29"
7 category: "File Viewers & Editors"
8---
9
10# Implementing Syncfusion React Image Editor
11
12The Syncfusion React Image Editor is a comprehensive, feature-rich component for editing images directly in your React applications. It provides an intuitive interface with powerful tools for transformations, annotations, effects, and more.
13
14## Component Overview
15
16The Image Editor combines a canvas-based editing environment with a comprehensive toolbar and contextual tools. It supports:
17
18- **Multiple Input Sources:** Files, URLs, base64, blobs, file managers, treeviews
19- **Rich Annotation Support:** Text (with styling), shapes, freehand drawings, watermarks
20- **Professional Effects:** Filters and fine-tuning controls
21- **Advanced Operations:** Z-order management, redaction, frame decoration
22- **Accessibility First:** Full keyboard navigation, WCAG compliance, RTL support, 120+ localization keys
23- **Flexible Integration:** Standalone or within dialogs, with customizable toolbars
24
25## Documentation and Navigation Guide
26
27### 🔹 API Reference
28📄 **Read:** [references/api.md](references/api.md)
29- Complete API documentation with all properties, methods, and events
30- Properties overview (core, toolbar, settings)
31- Methods for image operations, transformations, annotations
32- Events for lifecycle, interactions, effects, and toolbars
33- Enums and type definitions (ArrowheadType, FrameType, RedactType, etc.)
34- Complete working examples with verified method signatures
35
36### Getting Started
37📄 **Read:** [references/getting-started.md](references/getting-started.md)
38- Installation with Vite and create-react-app
39- CSS imports and theme setup
40- Basic component initialization
41- Setting width, height, and initial rendering
42
43### Opening and Saving Images
44📄 **Read:** [references/opening-saving-images.md](references/opening-saving-images.md)
45- Open from file paths, URLs, base64 strings, blobs
46- Open from file uploader, file manager, and treeview
47- Save/export as PNG, JPEG, SVG, WEBP
48- Image dimensions and aspect ratio control
49- File opened, saving, and lifecycle events
50
51### Selection and Cropping
52📄 **Read:** [references/selection-cropping.md](references/selection-cropping.md)
53- Insert custom, square, and circle selections
54- Crop with aspect ratios (2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 5:7, 7:5, 9:16, 16:9)
55- Crop method and selection events
56- Maintain original image size during cropping
57- Lock selection area during resizing
58
59### Transform: Rotate, Flip, and Straighten
60📄 **Read:** [references/transform-rotate-flip.md](references/transform-rotate-flip.md)
61- Rotate clockwise/counter-clockwise by degrees
62- Flip horizontally and vertically
63- Straighten images with fine degree adjustments (-45° to +45°)
64- Transform annotations along with image
65- Rotating and flipping events
66
67### Zoom and Pan Operations
68📄 **Read:** [references/zooming-panning.md](references/zooming-panning.md)
69- Zoom in/out with configurable min/max factors
70- Pan when zoomed or during cropping
71- Zoom triggers (toolbar, pinch, mouse wheel, keyboard)
72- Zooming and panning events
73- Zoom point calculations
74
75### Text Annotations
76📄 **Read:** [references/text-annotations.md](references/text-annotations.md)
77- Add text with position, content, and font settings
78- Text styling (bold, italic, underline, strikethrough)
79- Font families, sizes, and colors
80- Multiline text with newline characters
81- Delete text annotations
82- Customize font color via shapeChanging event
83
84### Freehand Drawing
85📄 **Read:** [references/freehand-drawing.md](references/freehand-drawing.md)
86- Enable/disable freehand drawing mode
87- Customize stroke width and color
88- Delete freehand annotations
89- Adjust stroke during drawing via shapeChanging event
90
91### Shape Annotations
92📄 **Read:** [references/shape-annotations.md](references/shape-annotations.md)
93- Draw rectangles, ellipses, lines, arrows, and paths
94- Customize shapes with stroke color, stroke width, and fill color
95- Rotate shapes with degree parameter
96- Delete shape annotations
97- Customize default stroke colors
98- Shape changing and customization events
99
100### Image Annotations
101📄 **Read:** [references/image-annotations.md](references/image-annotations.md)
102- Add images or icons as annotations
103- Control position, size, rotation, and opacity
104- Aspect ratio preservation
105- Watermarks and decorative elements
106
107### Filters
108📄 **Read:** [references/filters.md](references/filters.md)
109- Apply predefined filters (Chrome, Cold, Warm, Grayscale, Sepia, Invert)
110- Image filtering event
111- Reset filter to original
112
113### Fine-Tuning
114📄 **Read:** [references/finetune.md](references/finetune.md)
115- Adjust brightness, contrast, saturation
116- Control hue, exposure, blur, opacity
117- Finetune value changing events
118- Real-time adjustments with sliders
119
120### Undo and Redo
121📄 **Read:** [references/undo-redo.md](references/undo-redo.md)
122- Undo/redo operations with 16-step history
123- Keyboard shortcuts (Ctrl+Z, Ctrl+Y)
124- History management and limits
125
126### Toolbar Customization
127📄 **Read:** [references/toolbar-customization.md](references/toolbar-customization.md)
128- Built-in toolbar items (20+ default tools)
129- Add, remove, enable, disable toolbar items
130- Custom toolbar items with event handlers
131- Contextual toolbar for annotations
132- Toolbar templates for complete customization
133- Toolbar created and item clicked events
134
135### Quick Access Toolbar
136📄 **Read:** [references/quick-access-toolbar.md](references/quick-access-toolbar.md)
137- Quick access toolbar for annotations
138- Show/hide quick access toolbar
139- Add custom items to quick access toolbar
140- Quick access toolbar open event
141
142### Resize Image
143📄 **Read:** [references/resize-image.md](references/resize-image.md)
144- Resize with or without aspect ratio
145- Width and height parameters
146- Resizing event with before/after dimensions
147
148### Frame Decoration
149📄 **Read:** [references/frame-decoration.md](references/frame-decoration.md)
150- Apply frames (Mat, Bevel, Line, Inset, Hook)
151- Customize frame color, size, and line style
152- Frame changing event
153
154### Z-Order Layering
155📄 **Read:** [references/z-order-layering.md](references/z-order-layering.md)
156- Bring forward/send backward annotations
157- Bring to front/send to back
158- Manage annotation layer order
159
160### Redact Sensitive Information
161📄 **Read:** [references/redact-sensitive-info.md](references/redact-sensitive-info.md)
162- Blur sensitive areas
163- Pixelate sensitive information
164- Redact CRUD operations (select, update, delete, get)
165- Privacy and compliance
166
167### Accessibility and Localization
168📄 **Read:** [references/accessibility-localization.md](references/accessibility-localization.md)
169- WCAG 2.2, Section 508 compliance
170- Screen reader support
171- Keyboard shortcuts (Ctrl+Z, Ctrl+S, Ctrl+O, Delete, Enter, Escape)
172- RTL language support
173- Localization with 120+ locale keys
174
175### Image Restrictions and Validation
176📄 **Read:** [references/image-restrictions-validation.md](references/image-restrictions-validation.md)
177- Allowed file extensions (.jpg, .png, .svg, .webp, .bmp)
178- Min and max file size restrictions
179- File validation and error alerts
180
181### Clear Image
182📄 **Read:** [references/clear-image.md](references/clear-image.md)
183- Clear editor state
184- Dialog reuse patterns
185- Remove previously loaded images
186
187### Fit to Width and Height
188📄 **Read:** [references/fit-width-height.md](references/fit-width-height.md)
189- Fit image to editor container width
190- Fit image to editor container height
191- Zoom calculations for perfect fit
192
193### Render in Dialog
194📄 **Read:** [references/render-in-dialog.md](references/render-in-dialog.md)
195- Render Image Editor within Dialog component
196- Content template integration
197- Dialog show/hide patterns
198
199### Reset Image
200📄 **Read:** [references/reset-image.md](references/reset-image.md)
201- Reset all modifications to original state
202- Restore unmodified version
203- Clear annotations and effects
204
205## Quick Start Example
206
207```tsx
208import { ImageEditorComponent } from '@syncfusion/ej2-react-image-editor';
209import React from 'react';
210
211function App() {
212 let imgObj: ImageEditorComponent;
213
214 function imageEditorCreated(): void {
215 imgObj.open('https://ej2.syncfusion.com/react/documentation/image-editor/images/bridge.jpeg');
216 }
217
218 return (
219 <div>
220 <ImageEditorComponent
221 ref={(img) => { imgObj = img }}
222 width="550px"
223 height="350px"
224 created={imageEditorCreated}
225 />
226 </div>
227 );
228}
229
230export default App;
231```
232
233## Common Patterns
234
235### Pattern 1: Open + Edit + Save Workflow
2361. Open image via `open()` method
2372. Apply transformations, annotations, or effects
2383. Use `export()` to save as PNG/JPEG/SVG/WEBP
2394. Optionally convert to base64 or blob for backend storage
240
241### Pattern 2: Responsive Toolbar
2421. Define custom toolbar items in `toolbar` property
2432. Handle clicks via `toolbarItemClicked` event
2443. Execute methods like `rotate()`, `zoom()`, `drawText()` based on clicked item
2454. Update contextual toolbar via `toolbarUpdating` event
246
247### Pattern 3: Annotation Workflow
2481. Enable annotation mode (freehand, text, shape)
2492. Customize via `shapeChanging` event (color, stroke, font)
2503. Delete via `deleteShape()` with shape ID
2514. Manage layers via z-order methods
252
253### Pattern 4: Dialog Integration
2541. Render Image Editor in Dialog's `content` template
2552. Load image when dialog opens via `fileOpened` event
2563. Call `clearImage()` before closing dialog
2574. Retrieve edited image data via `export()` or `getImageData()`
258
259### Pattern 5: Filter + Finetune Pipeline
2601. Apply filter via `applyImageFilter()`
2612. Fine-tune via `finetuneImage()` (brightness, contrast, etc.)
2623. Listen to `imageFiltering` and `finetuneValueChanging` events
2634. Combine effects for professional results
264
265## Key Properties
266
267| Property | Type | Purpose |
268|----------|------|---------|
269| `width` | string | Editor canvas width (e.g., "550px", "100%") |
270| `height` | string | Editor canvas height (e.g., "350px", "100%") |
271| `toolbar` | array | Customize toolbar items and visibility |
272| `fontFamily` | object | Add custom font families |
273| `uploadSettings` | object | Configure file restrictions (extensions, size) |
274| `zoomSettings` | object | Set min/max zoom factors |
275| `showQuickAccessToolbar` | boolean | Show/hide quick access toolbar |
276| `locale` | string | Set localization (e.g., 'de-DE') |
277
278## Key Events
279
280| Event | Trigger | Use Case |
281|-------|---------|----------|
282| `created` | Component initialized | Load image on startup |
283| `fileOpened` | Image loaded | Add watermarks, apply defaults |
284| `beforeSave` | Before export | Validate, add metadata |
285| `cropping` | During crop | Prevent scaling, lock dimensions |
286| `zooming` | During zoom | Validate zoom level |
287| `rotating` | During rotate | Track rotation angle |
288| `shapeChanging` | Annotation modified | Customize stroke, font |
289| `toolbarUpdating` | Toolbar rendered | Add/remove contextual items |
290
291## Supported File Formats
292
293**Open:** PNG, JPEG, JPG, SVG, WEBP, BMP (local, URL, base64, blob)
294**Save/Export:** PNG, JPEG, SVG, WEBP
295
296## Next Steps
297
298- Start with [getting-started.md](references/getting-started.md) for setup
299- Explore [opening-saving-images.md](references/opening-saving-images.md) to understand data flow
300- Check specific features in their dedicated reference files
301- Use [accessibility-localization.md](references/accessibility-localization.md) for multi-language support