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

Add feature to specify visualCrop: (CropShape) -> CropShape = { it } #25

Open
qavan opened this issue Nov 25, 2024 · 9 comments
Open

Add feature to specify visualCrop: (CropShape) -> CropShape = { it } #25

qavan opened this issue Nov 25, 2024 · 9 comments
Labels
feature New features

Comments

@qavan
Copy link

qavan commented Nov 25, 2024

Nice lib❤️
But helpful to have argument like visualCrop: (CropShape) -> CropShape = { it } to have "visual crop" of crop area.
One of usecases: cropping image for avatar in social media, when usually you see circle shaped image, but also can view full image(rect).
image

@tamimattafi
Copy link
Owner

Hello @qavan!
I'm not sure that I understood correctly what you mean. When you use shapes, you actually can see the full area while you are cropping. But when you press the crop button, you only get the cropped shape. This is a standard behavior for crop libraries.

To show the original picture in social media, it's better to save two versions, one cropped image for the small circular profile picture, and one original image without any cropping, which you will display when the user wants to view the full picture.

@tamimattafi
Copy link
Owner

Here's an example of the current circular crop:
example-circular

@qavan
Copy link
Author

qavan commented Nov 26, 2024

Yeah, visually same, BUT your result is rect image with black background out of circle. I want to have circle visual crop with fully rect image, without black background out of circle. This is why I want to introduce visualCrop feature(I dont know how to better name it)

Here work as I described, but it not CMP

@qavan
Copy link
Author

qavan commented Nov 26, 2024

To show the original picture in social media, it's better to save two versions, one cropped image for the small circular profile picture, and one original image without any cropping, which you will display when the user wants to view the full picture.

It depends

@tamimattafi
Copy link
Owner

@qavan Could you please attach a result bitmap, how it should look like after cropping, without the black background around the circle?

@tamimattafi
Copy link
Owner

@qavan Did I understand correctly, that the result image should have everything inside the cropping grid / square, but show a circular shape while cropping?
Is this example accurate?

Screenshot_20241126_160753_Krop.jpg

Screenshot_20241126_160913_Krop.jpg

@qavan
Copy link
Author

qavan commented Nov 26, 2024

@tamimattafi yes! Exactly!

@tamimattafi tamimattafi added the feature New features label Nov 26, 2024
@tamimattafi
Copy link
Owner

@qavan I understand now, thank you.

I think adding such a feature isn't hard, but I am not sure if I will find time in the upcoming days, since I'm on vacation.

Please feel free to make a pull request from 0.2.0 branch.

@vanniktech
Copy link

I'd also be interested in this particular use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New features
Projects
None yet
Development

No branches or pull requests

3 participants