|Pedro Sá Couto 33fee06e18 Update 'readme.md'||3 months ago|
|scans||3 months ago|
|.DS_Store||3 months ago|
|bounding_box.py||3 months ago|
|burstpdf.py||3 months ago|
|chmod.sh||3 months ago|
|merge_files.sh||3 months ago|
|merge_scans.sh||3 months ago|
|readme.md||3 months ago|
|tesseract_ocr.py||3 months ago|
|workshop_stream.sh||3 months ago|
This set of scripts was written for the Text Laundrette workshop. The workshop takes place in the Publication Station, WDkA building.
It is a workflow to turn the pictures from a Flatbed Scanner into a final OCRed PDF.
We will use a home-made, DIY book scanner, and open-source software to scan, process, and add digital features to printed texts brought by the participants to the workshop. Ultimately, we will include them in the “bootleg library”, a shadow library accessible over a local network.
Shadow libraries operate outside of legal copyright frameworks, in response to decreased open access to knowledge. This workshop aims to extend our research on libraries, their sociability, and methods by which we can add provenance to texts included in public or private, legal or extra-legal collections.
Participants should bring: a printed text, which they’d like to digitize and share.
You’ll need the command-line tools for Xcode installed.
After install Homebrew.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Run the following command once you’re done to ensure Homebrew is installed and working properly:
sudo apt-get install python3 python3-pip imagemagick poppler pdfunite
brew install python3 python3-pip imagemagick poppler pdfunite
sudo pip3 install pdf2image Pillow time logging opencv-python pytesseract
Your scans must look like this for the scripts to perform right.
RIGHT PAGE ————————————————————— | | |—————————— | | | | | | | | | | | | | | | | | 01 | | |—————————— | | | ————————————————————— LEFT PAGE RIGHT PAGE ————————————————————— ————————————————————— | | | | | ——————————| |—————————— | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 02 | | 03 | | | —————————— | |—————————— | | | | | ————————————————————— —————————————————————
Add your pictures from the book scanner to the folder "/scans"
Make all the files executable.
sudo chmod 777 merge_scans.sh workshop_stream.sh marge_files.sh
In case you want to skip any of the scripts just comment out in the shell code, workshop_stream.sh.
The workflow follows these scripts, by successive order:
mkdir split mkdir ocred mkdir cropped
All the scans will be appended to one pdf called out.pdf
Burst this pdf, renaming all the files so they can be iterated later.
The pages are now in their original position, but they have a bounding box. This script iterates through them and crops the highest contrast area found.
In this part we OCR the jpg, turning these into PDFs.
The OCRed pages are now joined into their final PDF, your book is ready :)
The package is available as open source under the terms of the MIT License.