Install from the Python Package Index (PyPI) by running this command
pip install look-like-scanned
Or to install the latest version from GitHub
# Clone repo from GitHub and install
git clone https://github.com/navchandar/look-like-scanned.git
cd look-like-scanned
pip install poetry
poetry install
pip install .
# print help message and usage options available and verify the installation
scanner -h
# Scanner version: 1.0.0
This package uses PIL and pypdfium2 to convert and manipulate image and PDF objects.
This is extended to provide a command-line interface (CLI) for easy usage.
# Convert all pdf files in folder to scanned pdf
scanner -i .\tests
scanner -i .\tests -f "pdf"
# Convert all pdf files in folder to scanned without askew
scanner -i .\tests -a no
# Convert specific pdf file in folder to scanned pdf
scanner -i .\tests -f "test.pdf"
# Convert all jpg, jpeg, png, webp files in folder to one pdf file
scanner -i .\tests -f "image"
# Convert all png files in folder to pdf with 100% quality to one pdf file
scanner -i .\tests -f "png" -q 100
# Convert specific jpg file in folder to pdf with 75% quality to one pdf file
scanner -i .\tests -f "JPG_Test.jpg" -q 75
# Convert all PDF files including sub folders
scanner -i .\tests -f "pdf" -r yes
# Convert all Images including sub folders into one PDF
scanner -i .\tests -f "image" -r yes
# Convert all image files in folder in the order of file names
scanner -i .\tests -f "image" -s "name"
# Convert all PDF files including sub folders and save in black & white format
scanner -i .\tests -f "pdf" -r yes -b yes
# Convert all png files including sub folders and make it a little blurry
scanner -i .\tests -f "png" -r yes -b yes -l yes
These are the command-line arguments accepted:
-i, --input_folder
- Specifies the input folder to read files from and convert. The default
value is the current directory.-f, --file_type_or_name
- Specifies the file types to process or the file name to convert. The
default value is "pdf" to convert all PDF files in the given input folder.-q, --file_quality
- Specifies the quality of the converted output files. The value must be
between 50 and 100. The default value is 95.-a, --askew
- Controls whether to make the output documents slightly askew or slightly tilted.
Accepted values are "yes" or "no". The default value is "yes".-b, --black_and_white
- Controls whether to save output documents in black and white format (to
make it look like a photocopy). Accepted values are "yes" or "no". The default value is "no".-l, blur
- Controls whether to make the output a little bit blurry. Accepted values are
"yes" or "no". The default value is "no".-r, --recurse
- Allows scripts to find all matching files including subdirectories. Accepted
values are "yes" or "no". The default value is "yes".-s, --sort_by
- Alllows scripts to sort the files based on name, creation time or modified time.
Accepted values are "name", "ctime", "mtime", "none". The default value is "name".
If "none" is selected, then the default order of files returned by the OS is used for document conversion.