-
-
Notifications
You must be signed in to change notification settings - Fork 351
Open
Description
when I am getting the Final Crop image, not equal matching my crop area image, let me know, if i am doing wrong
also its not working in macBook.
const handleCropComplete = (crop: any) => {
setCompletedCrop(crop);
if (crop.width && crop.height) {
// Generate the cropped image data URL
const image = new Image();
image.src = ProfileImage;
const canvas = document.createElement("canvas");
canvas.width = crop.width;
canvas.height = crop.height;
const ctx = canvas.getContext("2d");
if (ctx) {
ctx.drawImage(
image,
crop.x,
crop.y,
crop.width,
crop.height,
0,
0,
crop.width,
crop.height
);
const croppedDataURL: any = canvas.toDataURL("image/jpeg");
setCroppedImage(croppedDataURL);
}
}
};
fevernova90, iamkashhif and MrSalaiamkashhifWalidnurudin
Metadata
Metadata
Assignees
Labels
No labels