Skip to content

Commit

Permalink
Create output directory if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
baltpeter committed Jan 12, 2021
1 parent 373263f commit 4144a72
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ numpy = "*"
pyzbar = "*"

[dev-packages]
autopep8 = "*"

[requires]
python_version = "3.8"
32 changes: 29 additions & 3 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions scanprep/scanprep.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from PIL import Image, ImageFilter, ImageStat
import numpy as np
import os
import pathlib
from pyzbar.pyzbar import decode


Expand Down Expand Up @@ -57,6 +58,8 @@ def get_new_docs_pages(doc, separate=True, remove_blank=True):


def emit_new_documents(doc, filename, out_dir, separate=True, remove_blank=True):
pathlib.Path(out_dir).mkdir(parents=True, exist_ok=True)

new_docs = get_new_docs_pages(doc, separate, remove_blank)
for i, pages in enumerate(new_docs):
new_doc = fitz.open() # Will create a new, blank document.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="scanprep",
version="1.0.1",
version="1.0.2",
author="Benjamin Altpeter",
author_email="[email protected]",
description="Small utility to prepare scanned documents. Supports separating PDF files by separator pages and removing blank pages.",
Expand Down

0 comments on commit 4144a72

Please sign in to comment.