logprint_extractor
A Python package for extracting depth-labelled PNG strips from PDF borehole image log prints.
Each page of the PDF is cropped to the log track and saved as a PNG whose filename encodes the top and bottom depth of that strip — the format required for import into WellCAD as an RGB image.
Contact irene@cubicearth.nz for more information on extracting and using historic borehole image data.
Installation
pip install logprint_extractor
Requires Python ≥ 3.11. Dependencies (pymupdf, Pillow, matplotlib) are installed automatically.
Workflow
The extraction is a three-step process, each covered by a script in the tutorial/ folder.
Step 1 — Find pixel coordinates (tutorial/step1_find_pixel_range.py)
Use pxl_range() to interactively select the crop region on a rendered PDF page.
Run this once for each distinct page layout (typically: first page, a representative middle page, and the last page).
- A matplotlib window opens showing the rendered page.
- Use the built-in zoom/pan tools to navigate to the area of interest.
- Toggle Selection Mode on, then click the top-left corner of the log strip.
- Press Accept Point to lock it in.
- Navigate to the bottom-right corner, click, then press Accept Point again.
- Close the window — the coordinate dict is printed to the terminal.
- Copy the coordinates into steps 2 and 3.
Step 2 — Verify the crop (tutorial/step2_inspect_image.py)
Use inspect_image() to display the cropped region for the first, a middle, and the last page.
Confirm the crop looks correct before running the full extraction.
Step 3 — Extract images (tutorial/step3_extract_image.py)
Use extract_image() to batch-process all included pages.
Each page is saved as a PNG named with its depth range, for example:
FORGE_78B-32 224.70 - 228.65.png
API reference
| Function | Description |
|---|---|
pxl_range(pdf_path, page_num) |
Interactively define a crop rectangle and return pixel coordinates. |
inspect_image(pdf_path, page_num, pixel_coords) |
Display a single cropped page region for verification. |
extract_image(pdf_path, output_dir, wellname, top_depth, base_depth, ...) |
Batch-extract depth-labelled PNG strips from all included pages. |
Tutorial data
The tutorial scripts use an open-access FMI log print from the Utah FORGE project:
McLennan, J. (2021). Utah FORGE: Well 78B-32 Daily Drilling Reports and Logs. [Data set]. Geothermal Data Repository. Energy and Geoscience Institute at the University of Utah. https://doi.org/10.15121/1814488
The PDF (University_Utah_FORGE_78B-32_FMI_Interpretation_20.pdf) can be downloaded from
https://gdr.openei.org/submissions/1330.
Metadata
Release files for logprint-extractor 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| logprint_extractor-0.1.1.tar.gz | 12.9 kB | Without provenance | Details for logprint_extractor-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| logprint_extractor-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for logprint_extractor-0.1.1-py3-none-any.whl |
Total release size: 26.4 kB
Release files / logprint_extractor-0.1.1.tar.gz
| Download URL | logprint_extractor-0.1.1.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bdddc0b83858bcf51e443377d359d389bc95e8294faeaefca1bcf09206963b4b
|
|
BLAKE2b-256 checksum How to use checksums |
f7be9340579abfae3811113b83c319fb7e7e2e0256a88df438482558c0384f33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / logprint_extractor-0.1.1-py3-none-any.whl
| Download URL | logprint_extractor-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00ffd10a4701c650a6c77dfef11cb1af3548d0fd58cb58a178905de2435fc21c
|
|
BLAKE2b-256 checksum How to use checksums |
593495e6fb6b2fc55c821a89a5758f3c0496f7c8fd9fdd7a73f639e350405307
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for logprint-extractor 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.