Comments (7)
Hi I'm not sure whether I'll try and fix it or deprecate it, it was added via PR from someone but feels extraneous to the core API and never sat well with me. I'll take a look and see if I can replicate this issue but I'm unlikely to add more complexity to the code to try and fix it (more likely to remove complexity from the code by removing it entirely - sorry!)
from react-image-crop.
Sorry to say but this feature is going away in v2 I'm releasing probably this weekend, as it's a feature I don't have time/inclination to get working properly and I want to remove bloat from the codebase. v2 has a couple of breaking changes but no major difference so feel free to carry on using v1 if you want it
from react-image-crop.
@dominictobias Would you consider keeping it if I submitted a PR to fix it? I haven't looked at the code at all, but I might consider it.
from react-image-crop.
Feel free to try, but you might find it tricky, also since this is just a visual change I would be surprised if the jumping didn't happen for rectangles. IIRC this should only happen when drawing a new shape but I'll have a try and see if I can replicate when I have some time in the next week.
from react-image-crop.
Hi @adelespinasse, have you made any progress on this since? I'm running into a similar problem. Thanks!
from react-image-crop.
@aaronshim It hasn't been at the top of my priorities. I just use a square crop. :/
from react-image-crop.
try this
const canvas = getResizedCanvas(previewCanvas, crop.width, crop.height);
const base64Image = canvas.toDataURL('image/png');
console.log('base64Image', base64Image);
function getResizedCanvas(canvas, newWidth, newHeight) {
const tmpCanvas = document.createElement('canvas');
tmpCanvas.width = newWidth;
tmpCanvas.height = newHeight;
const ctx = tmpCanvas.getContext('2d');
ctx.save();
ctx.beginPath();
ctx.arc(newWidth / 2, newHeight / 2, newHeight / 2, 0, Math.PI * 2, false);
ctx.closePath();
ctx.clip();
ctx.drawImage(
canvas,
0,
0,
canvas.width,
canvas.height,
0,
0,
newWidth,
newHeight
);
ctx.restore();
// const base64Image = canvas.toDataURL('image/jpeg');
return tmpCanvas;
}
from react-image-crop.
Related Issues (20)
- when we have circularCrop as prop, how to set the points on circle? HOT 3
- Need to rotate selected(croped) image HOT 4
- Synchronization Issue Between Multiple Cropper Instances on the Same Page HOT 2
- Image Cropping with 8/3 Aspect Ratio Causing Loss of Half Portion After Retrieval for s3 HOT 2
- Canvas toBlob crop not working on Sandbox (iOS) HOT 5
- Crop mask stays present with zero-size crop HOT 1
- SecurityError: OffscreenCanvas.convertToBlob: Cannot get blob from write-only canvas. HOT 1
- Canvas returns null after cropping image iOS HOT 1
- Mask is does'nt showing the first time HOT 6
- Memory leak risk due to event listeners not removed on componentWillUnmount HOT 1
- mask does not fully cover the image when the image to a smaller aspect ratio HOT 2
- Multiple crop selection on an image at the same time HOT 1
- Can the cropper be used for outpainting?
- React Crop as Dialog Box
- The previous image layout still be kept after switch image
- Feature request: Add the option to rotate the crop selection
- Proportional Stretching of Crop Box
- iPhone 15's 24 MP (res 4284 X 5712) image resolution is making the image black after cropping. HOT 1
- Library not supporting image cropping in iOS WebView HOT 6
- Add whitespace around image being cropped?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-image-crop.