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

Best way to trim white space around pictures? #627

Open
yoanhg421 opened this issue Mar 27, 2024 · 1 comment
Open

Best way to trim white space around pictures? #627

yoanhg421 opened this issue Mar 27, 2024 · 1 comment

Comments

@yoanhg421
Copy link

I’m trying to do a trim on an image with less than ideal quality and some JPEG artifacts. The trim function works well and is very fast but it’s looking for perfect white color and sometimes this causes some images to have extra space around them.

I tried increasing the contracts to remove the artifacts then findTrim and then copyCrop but this is very slow when processing a list of pictures

I also tried chaining the methods but the findTrim breaks the CMD sequence so I can’t do that.

I also noticed that each method that returns a new image ends up altering the original decoded variable. This causes me having to decode the image into two separate variables. One for the find trim and the other to actually crop the image. This looks like a Dart problem but I’m not sure.

Any advice on this would be great.

@brendan-duncan
Copy link
Owner

It's true, the trim functions don't have much wiggle room for things like jpeg artifacts. . I'm not really sure what to do about it. Not even Photoshop's trim deals with that. Maybe a tolerance parameter, look at the luminance of the pixel and trim it if the luminance is within the tolerance, but I'm not sure what that would actually do.

And it seems like I neglected to make a command for findTrim, which you could feed into copyCrop. I'll have to think on that some more, see if I can figure something out for that.

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

No branches or pull requests

2 participants