V7.0.0 crop in pixel
See original GitHub issueHi!
I’m just testing the new version of react-image-crop and I think there is a issue with the coords/size of crop
.
In the previous version I was using pixelCrop
from onComplete
to get the real coords/size of selection (regardless resize due to CSS). But in the new version the crop coords/size seems to be relative to a scale due to resize.
This make incompatible pixelCrop
from te previous version and crop of the new one.
Also, the old pixelCrop is not available.
In my opinion, we should always return the real crop size, regardless a resize from the browser.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:18 (8 by maintainers)
Top Results From Across the Web
react-image-crop - npm.io
Min/max crop size. Crop anything, not just images. If React Crop doesn't cover your requirements then take a look at Pintura. It features...
Read more >How to pick image for crop from camera or gallery in Android ...
I just solve this problem on Nexus6p android N,you need grant permission to uri so the system camera can access the file wait...
Read more >Advanced Custom Fields: Image Aspect Ratio Crop Field
Description. A field for Advanced Custom Fields that forces the user to crop their image to specific aspect ratio or pixel size after...
Read more >Annotated List of Command-line Options - ImageMagick
Copy pixels from one area of an image to another. -crop geometry { @ }{ ! } Cut out one or more rectangular...
Read more >How to Crop to Exact Pixel Sizes in Photoshop - YouTube
http://www.steeletraining.com - Learn how to crop your photos to exact pixel dimensions in Photoshop or Elements. Tutorial by Phil Steele.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It took me a while to figure out that V7 is now pixel value based since the example is still based one the previous version. 🤣 The way I solved this is to update the crop in
onImageLoaded
, returningfalse
so thatonCropComplete
/onCropChange
don’t fire (documentation needs to be updated). I added aresize
listener and re-calculate the crop whenever the browser size changes When I pass an updated crop back to the parent component, I convert the crop back to its original values. I think it should be relatively straightforward to support this out of the box (optional), perhaps passing a scale adjusted crop and a crop based on the natural dimensions of the imageThanks for looking into this I think it’s related to using
transform
for x + y instead oftop
andleft
which I was doing before. I’ll check and publish a fix later (blocked at work)