Skip to main content

ScrollWeave

Stitch scrolling screenshots into a clean page. Python API, Rust core, no third-party runtime dependencies.

PyPI CI License: MIT

ScrollWeave reconstructs a long page from overlapping screenshots. It estimates the scroll motion, detects persistent browser chrome such as fixed headers and sidebars, and copies the original image pixels into the output. No image content is generated.

Features

  • Layered reconstruction of vertically scrolling pages
  • Automatic fixed header, footer, and left/right sidebar detection
  • Automatic small horizontal capture-drift correction
  • Automatic inner-pane detection for fixed application windows
  • Multi-band 2D gradient NCC with graph consensus for automatic offsets
  • Optional Viewport for explicit content regions
  • Basic 2D alignment and compositing
  • PNG, BMP and PPM support
  • Python standard library only at runtime; no NumPy, Pillow or SciPy
  • Rust core with no third-party crates

Install

python -m pip install scrollweave

Prebuilt wheels are available for Linux, Windows and macOS. On a platform without a wheel, pip builds the source distribution and needs Rust/Cargo and a linker.

To install a checkout:

python -m pip install .

Quick start

from scrollweave import stitch_layered

result = stitch_layered(['top.png', 'middle.png', 'bottom.png'])
result.save('page.png')

Scroll positions are optional and are estimated when omitted. If the screenshots contain lots of blank space, repeated patterns or heavy occlusion, pass the positions explicitly:

result = stitch_layered(
    ['top.png', 'middle.png', 'bottom.png'],
    scroll=[0, 640, 1280],
)

To crop a known content region, pass a Viewport:

from scrollweave import Viewport

result = stitch_layered(
    ['top.png', 'bottom.png'],
    scroll=[625, 0],
    viewport=Viewport(top=75, bottom=1035, left=357, right=1910),
)

Viewport uses source-frame coordinates; bottom and right are exclusive. If a viewport is omitted, ScrollWeave tries to detect fixed chrome and infer the content region automatically.

Python API

The main operations are:

from scrollweave import (
    Image,
    LayeredOptions,
    PlanOptions,
    Viewport,
    compose,
    plan_views,
    stitch_basic,
    stitch_layered,
)

# Layered reconstruction
result = stitch_layered(images_or_paths, scroll=[0, 640, 1280])

# Basic 2D alignment/compositing
basic = stitch_basic(images_or_paths, positions=[0, 640])

# Layout without alignment
combined = compose(images_or_paths, layout='vertical', gap=8)

# Recommend additional views from an existing layered result
suggestions = plan_views(result, PlanOptions(count=2))

stitch_layered returns LayeredResult with the output image, scroll positions, viewport, evidence maps and optional diagnostics. Image accepts raw RGB bytes:

frame = Image(width=32, height=32, rgb=b'\xff\x00\x00' * (32 * 32))

See docs/ARCHITECTURE.md for the processing pipeline and docs/PORT_STATUS.md for the current implementation status.

CLI

# Reconstruct a page; positions are estimated when omitted
scrollweave stitch shot-*.png -o page.png

# Explicit positions and an explicit content band
scrollweave stitch shot-*.png -o page.png --positions 0,640,1280 --viewport 75:1035

# Basic matcher
scrollweave stitch shot-*.png -o page.png --algorithm basic

# Compose images without alignment
scrollweave compose a.png b.png -o combined.png --layout horizontal

The Python module is also runnable directly with python -m scrollweave.

Errors

ScrollWeave raises specific exception types instead of passing raw OS or C error strings through to callers:

from scrollweave import Image, ImageFormatError, ImageIOError, InvalidArgumentError

try:
    Image.open('missing.png')
except ImageIOError as exc:
    print(exc)  # includes the path and a human-readable reason

The exception hierarchy is:

Exception Meaning
InvalidArgumentError Invalid or inconsistent API arguments (ValueError)
LimitError A size/count/allocation limit was exceeded (ValueError)
UnsupportedFormatError Unsupported image or output format (ValueError)
ImageIOError File could not be opened, created or written (OSError)
ImageFormatError Image bytes are corrupt or malformed (ValueError)
NativeError General native-engine failure (RuntimeError)
NativeUnavailable Native library is missing or has an ABI mismatch (RuntimeError)
InternalError Unexpected native panic or invariant failure (RuntimeError)

All of these inherit from ScrollWeaveError.

Limitations

  • Layered reconstruction handles vertical scrolling and same-sized frames. Use stitch_basic for arbitrary 2D positions.
  • Input formats are PNG, BMP and PPM; JPEG, HEIC and video are not supported.
  • OCR, semantic segmentation and learned UI detection are not included.
  • Automatic scroll estimation can be ambiguous on blank or periodic pages; explicit positions are the reliable option there.
  • Output pixels are copied from input frames; missing content is not invented.

Development

cargo test --workspace --all-targets
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
python -m unittest discover -s tests/python
python -m ruff format --check .
python -m ruff check .

For an end-to-end browser regression, build the native library and run the stdlib-only corpus harness (requires Node 22+ and Chrome or Chromium):

cargo build --release -p scrollweave-ffi
python tools/web_smoke.py --count 120

It generates 120 real HTML pages with fixed headers, footers, sidebars, themes, responsive viewports and assorted content, captures scrolling viewport frames plus full-page truth in headless Chrome, and reports automatic and known-geometry reconstruction metrics in output/web_smoke/. Use --no-capture to re-evaluate an existing capture and --explicit to add the known-geometry reference run. See docs/WEB_SMOKE.md for the protocol and pass criteria. The dataset is deterministic and is not committed; the generator is tools/web_corpus.py and the DevTools capture helper is tools/web_capture.mjs.

The same capture/evaluation pipeline can crawl arbitrary HTTP(S) pages:

python tools/web_crawl.py https://example.com --root output/web_crawl --explicit
python tools/web_crawl.py https://docs.python.org/3/ --discover-depth 2 --max-pages 25

web_crawl.py warms up lazy content, detects fixed/sticky edge chrome from computed CSS, and reports the same metrics. Capture failures are isolated per page, stale captures are cleared, and oversized/tall pages fail with a clear per-page diagnostic instead of aborting the crawl. Real pages may still contain animations or consent overlays, so use it as a diagnostic suite rather than a universal pixel-exact guarantee.

research/reference/ contains a frozen Python research reference used for future parity work. It is not imported or installed by the package.

License

MIT

Metadata

Release files for scrollweave 0.9.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scrollweave 0.9.5
File Size Uploaded Provenance Actions
scrollweave-0.9.5.tar.gz 229.4 kB With provenance Details for scrollweave-0.9.5.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for scrollweave 0.9.5
File Interpreter ABI Platform Actions
scrollweave-0.9.5-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for scrollweave-0.9.5-py3-none-win_amd64.whl
scrollweave-0.9.5-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details for scrollweave-0.9.5-py3-none-manylinux_2_34_x86_64.whl
scrollweave-0.9.5-py3-none-macosx_10_13_universal2.whl Python 3 none macOS 10.13+ universal2 (ARM64, x86-64) Details for scrollweave-0.9.5-py3-none-macosx_10_13_universal2.whl

Total release size: 1.3 MB

Release files / scrollweave-0.9.5.tar.gz

Download URL scrollweave-0.9.5.tar.gz
Size 229.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b468a2844a3376009fa7bc20b5b3b3bb46b9dd269e9aa85416192956156e82a6
BLAKE2b-256 checksum
How to use checksums
62a9c5ec35f8ef82310639aab0f5cfb2b583af633348ec3b12c71937c9e8227f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / scrollweave-0.9.5-py3-none-win_amd64.whl

Download URL scrollweave-0.9.5-py3-none-win_amd64.whl
Size 283.3 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
38e80ab99fa0fb8fad9f4404987eb306e25db79b73fff04f56c49a92ce3fc38d
BLAKE2b-256 checksum
How to use checksums
e29dd2ee343ef601c37c11570a12a55d79c7d1bad524ccdab1491bea6a6209b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / scrollweave-0.9.5-py3-none-manylinux_2_34_x86_64.whl

Download URL scrollweave-0.9.5-py3-none-manylinux_2_34_x86_64.whl
Size 407.4 kB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
906296f4acae5be0024434d351bf49b4780d30ecf45336ddcd562f3b76eb4e36
BLAKE2b-256 checksum
How to use checksums
87e2edb24fc6b845d0fd9738e0a1e476ba8a95fcffee3652b81f32a131e14e03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / scrollweave-0.9.5-py3-none-macosx_10_13_universal2.whl

Download URL scrollweave-0.9.5-py3-none-macosx_10_13_universal2.whl
Size 356.7 kB
Tags Python 3 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
ba3d15e6df86bbe77b34c8e8f56b758dd33b44e203c4902fe6c3737aab8d67f6
BLAKE2b-256 checksum
How to use checksums
dfd111b7c4638e75878763e445dbcafa155aba49c90d1082d2bbe3985b033652
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for scrollweave 0.9.5

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.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for scrollweave-0.9.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page