scaleflex / filerobot-image-editor

Edit, resize, and filter any image! Any questions or issues, please report to https://github.com/scaleflex/filerobot-image-editor/issues
MIT License
1.26k stars 321 forks source link

Selecting “Original” option from Crop menu not updating the image back to original size #460

Closed santhosh1190 closed 1 month ago

santhosh1190 commented 2 months ago

Hi Team,

Firstly, I would like to thank this team for developing this tool to handle the image with all types of options we need to work on images.

Now, Let me explain the issue that I am facing when selecting the “Original” option from the Crop menu. We could use your demo page to reproduce the issue.

Demo Link: https://scaleflex.github.io/filerobot-image-editor/

Steps:

  1. After page load, Select "Landscape" option from Crop menu and then the image would resize to selected position
  2. Select "Portrait" option from the Crop menu and then the image would resize to selected position.
  3. Now, Select "Original" option from Crop menu and image is not positioning to original size instead positioning to some random size.

When I select the "Original" option from the Crop menu, I need to have the position which initially occurred when the image loaded.

Please guide me to achieve it.

Has anyone faced this issue?

Thanks in advance,

AhmeeedMostafa commented 1 month ago

Hello @santhosh1190 ,

These are related to the crop ratios, not the crop dimensions, so changing the crop to any ratio of the listed options will reflect by changing the ratio of the crop respecting the current crop's dimensions (width & height) -- unless you have set specific dimensions in your custom crop options --

so this is an intended behavior, the original crop reverts the ratio to the original image's ratio but keeps the current dimensions.

santhosh1190 commented 1 month ago

@AhmeeedMostafa Thanks for the reply! How this could be intended behaviour and Still, I have been in confusion state? Please check below steps to understand what I have been trying to fix.

Demo: https://benkaiser.github.io/fast-image-resizer/

Using above demo page, I tried the Landscape crop option by following steps.

Step1: After loaded the page, Select the Adjust tool.

Step2: Now select Landscape option from Crop menu. Please refer the below image for output

image

Step3: Now select Portrait option. Please refer the below image for output

image

Step4: Again select Landscape option. Please refer the below image for output

image

I could see that Step2 and Step4 has the different output. Actually, Step2 and Step4 should have the same output. This is my expected behaviour.

More than 2 days I have been Struggling to fix the above issue. If possible, Could you please provide me the working code as per my requirement?