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 support for removing of blank pages #39

Merged
merged 3 commits into from
Sep 22, 2024

Conversation

pedropombeiro
Copy link
Collaborator

This PR integrates the part of the logic in https://calvinrw.com/brscan4-paperless-workflow that drops blank pages from duplex scans. In order to maintain backward compatibility, this logic is only active if the REMOVE_BLANK_THRESHOLD environment variable is defined. It installs 3 new packages: bc, pdftk, and poppler-utils.

Copy link
Owner

@PhilippMundhenk PhilippMundhenk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to provide a default value for threshold in the readme? Not apparently obvious, at least to me...

@pedropombeiro
Copy link
Collaborator Author

Done ✅

@PhilippMundhenk
Copy link
Owner

I noticed @calvinrw does not have a license in his repo, but since is at least heavily inspired by his work, might be worth to ask if he is ok to integrate this here. @calvinrw: Are you?

@PhilippMundhenk PhilippMundhenk merged commit c08a292 into master Sep 22, 2024
1 check passed
@pedropombeiro pedropombeiro deleted the pedropombeiro/remove-blanks branch September 22, 2024 18:51
@PhilippMundhenk
Copy link
Owner

@pedropombeiro: I just noticed the blank pages are only removed after scanning front and rear pages. While much less likely, there could also be an empty page in a stack of single-sided papers. Do you think it is worth adding it there as well? I don't have a clear opinion on this...

@pedropombeiro
Copy link
Collaborator Author

@pedropombeiro: I just noticed the blank pages are only removed after scanning front and rear pages. While much less likely, there could also be an empty page in a stack of single-sided papers. Do you think it is worth adding it there as well? I don't have a clear opinion on this...

I thought about this, and the conclusion I arrived at was that if there is a blank front page, probably the intention of the author is that the page remains, as opposed to when they occur on the backside, which is normally dictated by a technical reason (documents printed in simplex as opposed to duplex, etc.)

This can be easily added in the future, if we see that there are real-world scenarios that required though.

@pedropombeiro
Copy link
Collaborator Author

@PhilippMundhenk by the way, should this project have a space for discussions? There have been situations where I wanted to propose something (like the rewrite), but the only option is to open a PR or an issue.

@calvinrw
Copy link

@PhilippMundhenk Thanks for asking. I consider that entire body of work to be under the MIT License, so I have no issues at all if you want to incorporate parts of it into your own project. It's worth noting that this version of the blank page removal script was heavily based on an answer in a StackOverflow discussion, so I can't exactly take full credit for it.

@pedropombeiro
Copy link
Collaborator Author

Thanks for kindly allowing to use your work @calvinrw.

May I take this opportunity and ask a quick unrelated question? Are you able to scan in B/W and Color, depending on which button you press? One thing I noticed, maybe because this project uses scanimage instead of Brother's skey-scanimage, the decision needs to be taken through arguments passed to scanimage.

@PhilippMundhenk
Copy link
Owner

@PhilippMundhenk by the way, should this project have a space for discussions? There have been situations where I wanted to propose something (like the rewrite), but the only option is to open a PR or an issue.

Still catching up with all the additional contributions and the sudden attention. In the last 3-4 weeks, more things have happened here than in the last ten years (or however old this project is) combined... ;)
But here you go, discussions are open now: https://github.com/PhilippMundhenk/BrotherScannerDocker/discussions

@calvinrw
Copy link

@pedropombeiro The MFC-L2750DW doesn't present a choice for color versus BW scanning in its UI. You are right: the way I set it up, options like page size, duplex scanning, DPI, etc. are all "hard-coded" arguments to scanimage and were selected for my typical use case.

My older MFC-9020CN has separate "Black" and "Color" Start buttons, but which one gets selected when starting a scan doesn't matter for the same reason.

@pedropombeiro
Copy link
Collaborator Author

Thanks for the context @calvinrw. That matches what I'm seeing with my MFC-J4335DW, unfortunately. Not a big deal, since this scanner scans pretty quickly. It would be more of an issue with my previous Canon, which took a much longer time for color scans.

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.

3 participants