Skip to content
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

apply crop on the initial image given by the input path #46

Open
behrangnm opened this issue Sep 24, 2023 · 1 comment
Open

apply crop on the initial image given by the input path #46

behrangnm opened this issue Sep 24, 2023 · 1 comment
Labels
accepting-pull-requests bug Something isn't working

Comments

@behrangnm
Copy link

behrangnm commented Sep 24, 2023

Great package, thanks for all the work.
Is it possible to apply the crop that the user has performed through the UI on the initial input image to get the output? I'm trying to find a way of not losing image resolution as a result of displaying the image for cropping in a small view.
I was thinking I can get the current transition/scale/rotation after the image is loaded and manipulated by the user, but I don't know how to get the initial mapping from the original image to the image initially loaded into the ui to be able to complete the pipeline of correctly applying the crop to the input image.

On a second thought, maybe that's already what you are doing in the package, but I might be using things incorrectly. Let me tell you about my setup. I have a 1920x1080 input image and my crop percentage is set to 1. I'm defining the rectangular crop area of 16x9, and I'm not zooming in or out or moving the image at all after loading. I'm also using CustomImageFit.fitCropSpace. I expect when I'm cropping the image without touching it, the output should be a 1920x1080 image but I'm getting a 1080x607 image.

@ikbendewilliam ikbendewilliam added the bug Something isn't working label Oct 2, 2023
@ikbendewilliam
Copy link
Collaborator

The crop is indeed screen independent, meaning that if you have an image of 1920 width and a screensize of 100, the resulting image is still 1920 px wide (if you don't crop anything).
That being said, it sounds like you encountered a bug CustomImageFit.fillCropSpace is dependent on your aspect-ratio and the image aspect-ratio (so if width > height the calculation is different from width < height). And it seems that it took the height as the max width 🤔.
I currently have my hands full with projects, how big of an issue is this? Feel free to dive into the code and create a PR to fix it, I'll be happy to review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting-pull-requests bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants