Extract depth-labelled borehole images from PDF well log prints.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logprint_extractor-0.1.0.tar.gz.
File metadata
- Download URL: logprint_extractor-0.1.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
345702868ce924ab02095826fef4f5e638a80bb26407917d5d014f97219e2b33
|
|
| MD5 |
ecb583d62fde40086aae0ca688acc5bc
|
|
| BLAKE2b-256 |
9626a75ba09dedf8ec7842984e383d587c59822b386d7b4e0a1f17c0f627885a
|
File details
Details for the file logprint_extractor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: logprint_extractor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c5b097187478e3c0a3cf2c17a561fda3f1c4d3dcca3a552c71f8468dcd17b15
|
|
| MD5 |
63ef7eb8c94091881dd94709fc4cfd0c
|
|
| BLAKE2b-256 |
c23a1093b7be1338d2856b84f7f7bf62a58f9c64e5c3b46ed4531468ee65b006
|