import { CropperObj, IImageCropperResult } from '@eduswiper/types'; import { expose } from 'threads/worker'; expose(function onExportCanvas( cropperObj: CropperObj ): Promise<IImageCropperResult> { return new Promise((resolve) => { const imageData = cropperObj.cropper.getImageData(); const canvasData = cropperObj.cropper.getCanvasData(); const canvas = cropperObj.cropper.getCroppedCanvas(); const editedURL = canvas.toDataURL(); resolve({ canvasData, imageData, editedURL }); }); });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter