CropperBlazor / Cropper.Blazor

Cropper.js as Blazor component for cropping images
https://cropperblazor.github.io
MIT License
135 stars 14 forks source link

About the Draw a polygon when cropping #321

Open AlbertLiu1974 opened 5 months ago

AlbertLiu1974 commented 5 months ago

Hello,

I am writing some object detection on image loading via blazor WASM. Just want to know if we can use some other drawing functions like polygons, lines or arrows.. Kindly refer to the image or YT I recorded. thanks.

image

https://youtu.be/xOmG31Nv-Ew

Best regards, Albert Liu

MaxymGorn commented 5 months ago

Hi @AlbertLiu1974.

Sorry, in this library draw functions is absent. But, you can crop a polygon image

image

Sincerely, Maksym Hornytskiy

MaxymGorn commented 5 months ago

@AlbertLiu1974 Try to find some additional library for draw functionality, I did a quick search and found this: https://trevormare.github.io/STDoodle/help/doodledraw, maybe there is something else...

MaxymGorn commented 5 months ago

@AlbertLiu1974 Also, I know you can also use "fabric.js" for the drawing function, but you need to find a library for that or wrap the blazor interop module js library

MaxymGorn commented 2 months ago

Hi @AlbertLiu1974. New version of Cropper.Blazor will be realized which allows to use canvas or image reference in blazor to draw a polygon. New code was attached into dev branch.

MaxymGorn commented 2 months ago

You need to use GetCropperElementReference method to get reference into canvas or img and pass appropriate type for CropperComponentType parameter (default is img). More info in api docs (some links can be broken for new types now, it will be fixed later): https://cropperblazor.github.io/api#properties Screenshot_20240731_072503_Chrome Screenshot_20240731_073605_Chrome

Just note for CropperComponentType.Canvas type requires manual uploading of images into canvas HTMl element, including error handling. You can use GetCropperElementReference to get canvas reference and use all power of canvas functionality!

MaxymGorn commented 2 months ago

Hi @AlbertLiu1974. A new version of Cropper.Blazor (1.3.4) has been released that supports the mentioned topics!