Pintura Image Editor usage guides
A collection of code examples that cover lots of popular use cases. Nearly all examples include a sandbox link so you can experiment with the code and play with the editor API before use.
-
Absolute font size
Use the
createMarkupEditorShapeStyleControlsfunction to create custom shape style controls. -
Add watermark
Use the
postProcessImageDatahook to add a watermark to theimageDatabefore the output file is created. -
Empty canvas
Use an empty canvas element as
srcto load a new blank image. -
Circular crop overlay
Use the
willRenderCanvasproperty to adjust the preview image the editor renders. -
Compress image
Use the
qualityproperty on thecreateDefaultImageWriterfunction to lower the image output quality. -
Video thumbnail
Use the
processDefaultImageandtrimWillRenderControlshook to snap a video thumbnail. -
Crop square image
Use the
imageCropAspectRatioproperty to instruct the editor to make a crop in a fixed aspect ratio. -
Crop stickers
Use the
willRenderShapeControlsproperty to add a crop button above a sticker shape. -
Download image
Use the
URL.createObjectURLWeb API to turn the editor file output into a URL and download it to the local file system. -
Emoji picker
Use the
willRenderToolbarfunction to add custom controls -
Erase shapes
Use the
createMarkupEditorShapeStyleControlsfunction to create custom shape style controls. -
Generate image
Use the
processImageproperty function to generate an image without loading the user interface. -
Get Base64 DataURL
Convert a File object to a base64 encoded dataURL
-
Image preview
Use the
URL.createObjectURLWeb API to turn the editor file output into an image URL ready to set to an image element. -
Image upload
Use the
storeproperty to automatically upload output images to a server. -
Load HEIC image
Use the
preprocessImageFileproperty on thecreateDefaultImageReaderexport to add custom image loader logic. -
Load PDF pages
Use the
preprocessImageFileproperty on thecreateDefaultImageReaderexport to load a PDF page as an image -
Apply circular mask
Use the
postProcessImageDataproperty to mask theimageDatabefore the output file is created. -
Basic photo editor
We use the
willRenderToolbarhook to add buttons to the UI and create a basic photo editor. -
Text placeholders
Use the
preprocessImageStatehook to automatically replace placeholder values in text shapes. -
Replace sticker
Use the
willRenderShapeControlsproperty to add a select image button above a shape. -
Resize image
Use the
targetSizeproperty on thecreateDefaultImageWriterfunction to automatically resize images. -
Restore image state
Use the
imageStateproperty to restore a previously stored image editor state -
Save GIF image
Use the
postProcessImageBlobproperty to add a watermark to theimageDatabefore the output file is created. -
Style export button
Use the
willRenderToolbarandlayoutVerticalToolbarPreferenceproperties to adjust the style and position of the export button. -
Use custom fonts
Use the
createMarkupEditorShapeStyleControlsfunction to create custom shape style controls. -
Edit file input image
Use the
openDefaultEditorfactory to open an image when it's added to a file input -
Custom export button
We can use
willRenderToolbarto replace the default export button -
Face detection
Using a third party script to automatically set the crop rectangle to the image subject.