-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rectangle crop and results dimensions #21
Comments
A little bit more. I'm able to work around this because I know the specific width and height I want the resulting rectangle to be, and I can enforce the rectangle aspect ratio. However, I would think that the default "size" for a rectangle should be the rectangle w/h relative to the original image size. |
As far as i remember, default is square. Correct me if i am wrong. |
The default result-image-size is indeed a square (200x200). However, for a rectangular crop (area-type=rectangle) that isn't 200x200, you image will be padded or resized to fit into the 200x200 area. Let's say your rectangle is 200x100. The bottom half of your resulting image will be white. I would think that by default, if the result-image-size attribute isn't specified for area-type= rectangle, you would automatically return an image that is relative to the original image. If the user specifies a result-image-size, the rectangular cropped area would be scaled appropriately. Let's say the original image is 2000x1000, and that scales to screen coordinates/image size of 200x100. I crop a rectangle that is 20x10 on the image. Without specifying the size, I'd expect that the resulting image would be 200x100 (Scaled relative to the original image size of 2000x1000). However, let's say I specified my result-image-size to w:250 h:125, then the cropped area would scale to fit those dimensions. I think it's a strange behavior to conform a rectangle crop to 200x200 when you don't specify a result-image-size. |
I agree that it's non-obvious behavior, you should end up with a picture relative to the size of the rectangle drawn. Being able to have the result image size be based on the source image would not be a bad idea either. So for example if you upload a very large image then you can crop a portion of it and still have a large image in the output. |
hmmm, that can be easly fixed, if anyone need it i could give instructions on how. |
@CrackerakiUA I would appreciate these instructions as I am currently running into this issue. thanks |
in this line https://github.com/CrackerakiUA/ngImgCropFullExtended/blob/master/source/js/classes/crop-host.js#L279 |
Just to add to @CrackerakiUA last post, I did the following and worked for me (I DIDN'T test it with circles, I'm just using rectangles and works like a charm). The original code was:
And this is my modified code:
I hope it helps... cheers! |
@andresarslanian's version works perfectly, however it stil generates the image of 200 pixel in size |
Nvm, if you use |
@CrackerakiUA @alex88 setting result-image-size="max" causes the browser to freeze for images over 10mb and setting to "selection" renders very poor quality . |
image 10mb and langer you can resize to smaller inside cropper and send to server original image and crop it there with options from cropper. On all my project i have added resize down to 1920/1080 each max before opening the cropper and everything works smooth. |
This fix works for me too, the white space is gone. Why hasn't this been merged in yet? |
Need to give some time to add it as feature. |
This repo is dead. |
When using rectangle crop and I don't specify a result-image-size, the resulting rectangle is 200x200. If the crop area is truly a rectangle (w != h), this result includes whitespace.
My html:
<img-crop image="origImage" result-image="croppedImage" area-type="rectangle" chargement="'Loading'" result-image-quality="1.0" ></img-crop>
How can I force the component to use the crop rectangle dimensions instead? Shouldn't this be default mode for cropping a rectangle? Do I use the scaling property instead?
The text was updated successfully, but these errors were encountered: