Image Editor Showcase

Some filters are not supported by some browsers

Drag and drop file here or

Component Documentation

Component Name

ImageEditor

Builder Function Name

create_image_editor_manager

Description

provides a comprehensive interface for editing images (crop, resize, filters, AI-based transformations, file export) within a popover or inline panel

Use like example

Config

PropertyTypeDefaultDescription
on_finishfunction

invoked when the user taps 'Finish', receives the final edited file

ai_image_generatorfunction

optional async function for generating an image from text, should return { is_success: boolean, data?: base64StringOrURL, error_message?: string }

ai_remove_image_backgroundfunction

optional async function to remove an image’s background, returns { is_success: boolean, data?: fileUrl, error_message?: string }

ai_restore_resolutionfunction

optional async function to upscale/rest. resolution, returns { is_success: boolean, data?: fileUrl, error_message?: string }

ai_restore_facefunction

optional async function to restore or enhance a face in an image

Methods

MethodDescriptionParametersReturns
init

initializes manager state, sets up popovers, panels, and button managers

config: object

void
init_file

assigns a new file for editing, sets up hidden image for transformations, updates UI states

file_input: object containing { file: File, file_name?: string, mime_type?: string }

void
on_destroy

cleanup callback run on svelte onDestroy, removes hidden image from the dom

No Params

void
set_screen_tab

switches the editor’s main tab: 'filters','crop','resize','ai','file'

screen_tab_loc: string

void
undo

reverts to a previous image state (if available)

No Params

void
redo

restores a more recent image state (if undone)

No Params

void
clear

clears the current image(s), resets to no file

No Params

void
finish

calls on_finish with the final edited file, closes the popover if in popover mode

No Params

void
set_base_image

sets the hidden base image src, resets transformations

new_src: string (data url or blob url)

void
apply_filters

applies current filter settings to the canvas, saves updated data url to the history stack

No Params

void
reset_filters

resets all filter sliders to their default values

No Params

void
main_image_transformer

the core function that assembles the image changes (crop, resize, filter) into the final canvas

No Params

void
crop_on_up

cancels the current pointer-based crop action when pointer is lifted

e: event

void
crop_on_move

moves or resizes the crop box based on user pointer drag, updating internal state

e: event

void
crop_on_down

begins the pointer-based crop drag from a handle or the main area, storing initial positions

e: event

type: string (the drag handle name)

void
set_crop_box

sets the crop area to a given aspect ratio or free if w/h are null

w: number or null

h: number or null

void
crop_image

applies the crop changes into a new data url, updates the history stack

w: number or null

h: number or null

void
toggle_is_lock_resize_aspect_ratio

toggles aspect ratio lock for resizing

No Params

void
set_resize_dimensions

updates the width/height for resizing, honoring aspect ratio lock if enabled

w: number or null

h: number or null

void
file_input_change

handles changes to file name, mime type, or quality; triggers a file size recalculation for the edited image

file_name: string

mime_type: string

quality: number

void
download_image

downloads the currently displayed image as a file with the specified mime type and name

No Params

void
set_file_from_inputs

applies the chosen file name, mime type, quality changes to the final data url, updates state

No Params

void
drop_handler

handles drag-drop events for files, calls init_file if a valid image file is found

e: drag-event

void

Returned Properties

PropertyTypeDescription
idstring

unique id for this editor instance

file_picker_fileobject

the initially picked file object if set

image_sourcesarray

an array of data urls for undo/redo functionality (history stack)

image_source_indexnumber

the current index in the history stack

selected_image_sourcestring

the currently displayed image data url

screen_tabstring

the active tab in the editor: 'filters','crop','resize','ai','file'

crop_leftnumber

the crop box left position in canvas px

crop_topnumber

the crop box top position in canvas px

crop_widthnumber

the crop box width in canvas px

crop_heightnumber

the crop box height in canvas px

is_disabledboolean

disables the editor UI if true

current_image_widthnumber

the current image’s actual width after base or transformations

current_image_heightnumber

the current image’s actual height after base or transformations

image_pixels_crop_widthnumber

the final cropped width in pixels

image_pixels_crop_heightnumber

the final cropped height in pixels

current_image_arnumber

the current image aspect ratio after transformations (width/height)

crop_aspect_rationumber

the aspect ratio for the crop box if set, else null for free

is_lock_resize_aspect_ratioboolean

if true, the width/height maintain the original aspect ratio

resize_widthnumber

the final width after resizing

resize_heightnumber

the final height after resizing

file_size_dataobject

metadata on file size at various qualities (for certain formats)

mime_type_inputstring

the user-selected mime type for the final image

file_size_kbnumber

the approximate size in kilobytes of the final image at the chosen settings

file_namestring

the base name for the final file

file_name_derivedstring

the sanitized version of the file name (alphanumeric, underscores, etc.)

file_name_derived_with_extensionstring

the final file name with an appropriate file extension

ai_error_messagestring

error messages generated by AI tasks (removing BG, upscaling, etc.)

file_input_managerobject

manages the underlying file input used to load images

screen_tab_filters_button_managerobject

button manager to open the 'filters' tab

screen_tab_crop_button_managerobject

button manager to open the 'crop' tab

screen_tab_resize_button_managerobject

button manager to open the 'resize' tab

screen_tab_ai_button_managerobject

button manager to open the 'ai' tab

screen_tab_file_button_managerobject

button manager to open the 'file' tab

undo_button_managerobject

button manager for undo

redo_button_managerobject

button manager for redo

clear_button_managerobject

button manager that clears all images from the editor

finish_button_managerobject

button manager that finalizes editing

filter_brightness_slider_managerobject

slider manager controlling brightness

filter_contrast_slider_managerobject

slider manager controlling contrast

filter_saturation_slider_managerobject

slider manager controlling saturation

filter_grayscale_slider_managerobject

slider manager controlling grayscale

filter_hue_slider_managerobject

slider manager controlling hue rotation

filter_red_slider_managerobject

slider manager controlling red channel

filter_green_slider_managerobject

slider manager controlling green channel

filter_blue_slider_managerobject

slider manager controlling blue channel

filter_blur_slider_managerobject

slider manager controlling blur effect

filter_opacity_slider_managerobject

slider manager controlling opacity

filters_set_default_button_managerobject

button manager to reset filter sliders to default

filters_apply_filters_button_managerobject

button manager to apply filters permanently and store in history stack

crop_free_button_managerobject

button manager setting the crop box to free aspect ratio

crop_one_to_one_button_managerobject

button manager for 1:1 aspect ratio

crop_four_to_three_button_managerobject

button manager for 4:3 aspect ratio

crop_three_to_two_button_managerobject

button manager for 3:2 aspect ratio

crop_sixteen_to_nine_button_managerobject

button manager for 16:9 aspect ratio

crop_three_to_four_button_managerobject

button manager for 3:4 aspect ratio

crop_two_to_three_button_managerobject

button manager for 2:3 aspect ratio

crop_nine_to_sixteen_button_managerobject

button manager for 9:16 aspect ratio

crop_width_ratio_text_input_managerobject

text input manager specifying custom crop aspect ratio width

crop_height_ratio_text_input_managerobject

text input manager specifying custom crop aspect ratio height

crop_image_button_managerobject

button manager that applies the current crop to the image

crop_aspect_width_locnumber

the currently set aspect ratio width for custom crop

crop_aspect_height_locnumber

the currently set aspect ratio height for custom crop

file_name_text_input_managerobject

text input manager controlling the user’s chosen file name

mime_type_webp_button_managerobject

button manager to select webp output format

mime_type_jpeg_button_managerobject

button manager to select jpeg output format

mime_type_png_button_managerobject

button manager to select png output format

download_image_button_managerobject

button manager to download the final image

set_file_changes_button_managerobject

button manager to apply the chosen file name, mime type, quality

shown_file_size_dataobject

the data for the currently selected mime type’s file size chart, if available

file_quality_slider_managerobject

slider manager for adjusting export compression quality (1–100)

ai_tab_dropdown_managerobject

dropdown manager to switch among AI-related tasks

ai_image_generator_is_loadingboolean

true if the text-to-image AI call is in progress

ai_generate_image_from_text_text_input_managerobject

text input manager containing the user’s text prompt for AI image generation

ai_generate_image_images_prompt_file_input_managerobject

file input manager containing the user’s image prompt for AI image generation

ai_generate_image_include_workspace_in_images_prompt_checkbox_managerobject

checkbox input manager containing if include workspace image in image prompt for AI image generation

ai_generate_image_from_text_button_managerobject

button manager to trigger AI image generation from text

ai_remove_bg_button_managerobject

button manager to trigger AI background removal

ai_restore_resolution_button_managerobject

button manager to trigger AI resolution restoration (upscale)

ai_restore_face_button_managerobject

button manager to restore a face in an image via AI

resize_width_dropdown_managerobject

dropdown manager specifying common width values for resize

resize_height_dropdown_managerobject

dropdown manager specifying common height values for resize

resize_width_text_input_managerobject

text input manager specifying custom resize width

resize_height_text_input_managerobject

text input manager specifying custom resize height

resize_aspect_ratio_lock_button_managerobject

button manager toggling aspect ratio lock for resizing

resize_image_button_managerobject

button manager that applies the resize changes

is_popoverboolean

if true, the entire editor appears in a popover

popover_managerobject

popover manager controlling the editor’s popover if is_popover is true

icon
Sponsored byContibase