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

Speed up autocrop significantly #1

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

nwc10
Copy link

@nwc10 nwc10 commented Jun 8, 2020

We've been using this module at work and it's very useful, but we sometimes have a lot of images to process and it can end up CPU bound. Hence:

The first commits add regression tests for border, greyscale images, AUTOCROP_ERROR_BLANK AUTOCROP_ERROR_NOCROP and a lot of (literal) corner and edge cases.

I then used these to refactor _scan to be much faster - maybe twice to three times faster (estimated by eyeballing the progress logs, not be any proper benchmark).

I hope that this is useful.

@do-know
Copy link
Owner

do-know commented Jun 9, 2020

That looks quite interesting, thanks. Would have to take a closer look during the weekend. Regarding the channels (1/3 vs 0/2) - that was more to avoid subtracting 1 way too often :)

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

Successfully merging this pull request may close these issues.

2 participants