Skip to main content

benchmark for read images.

Project description

imgread_benchmark

Benchmark for read images with different libs.

List Available Image Libraries

UV_CACHE_DIR=.uv-cache uv run imgread_benchmark libs

Dataset Management

You can download standard datasets for benchmarking using the imgread_benchmark data subcommand.

Imagenette

To download the full Imagenette dataset:

uv run imgread_benchmark data imagenette

To download a specific size (e.g., 160px or 320px):

uv run imgread_benchmark data imagenette --size 160

Datasets are stored in the .data/ directory by default.

Add External Backend Plugin (No Repo Code Changes)

imgread_benchmark discovers external backends via Python entry points. You do not need to modify this repository to add your backend.

  1. Create a plugin package (local or published) with an adapter module.
  2. Expose your backend via entry point group imgread_benchmark.img_libs.
  3. Install the plugin package into the same environment as imgread_benchmark.
  4. Verify with imgread_benchmark libs.

Minimal adapter example (my_backend_plugin.py):

from PIL import Image
import numpy as np


def read_img(path: str):
    return read_img_ndarray(path)


def read_img_pil(path: str) -> Image.Image:
    with Image.open(path) as img:
        return img.convert("RGB")


def read_img_ndarray(path: str) -> np.ndarray:
    return np.asarray(read_img_pil(path))


def is_available() -> bool:
    return True

Plugin pyproject.toml:

[project]
name = "my-backend-plugin"
version = "0.1.0"
dependencies = ["imgread_benchmark", "pillow", "numpy"]

[project.entry-points."imgread_benchmark.img_libs"]
my_backend = "my_backend_plugin"

Install plugin into current environment:

UV_CACHE_DIR=.uv-cache uv pip install -e /path/to/my-backend-plugin

Verify discovery and run benchmark:

UV_CACHE_DIR=.uv-cache uv run imgread_benchmark libs
UV_CACHE_DIR=.uv-cache uv run imgread_benchmark /path/to/images -l my_backend

Notes:

  • read_img, read_img_pil, and read_img_ndarray are optional individually.
  • For -t def, backend should provide read_img.
  • For -t pil, backend should provide read_img_pil.
  • For -t np, backend should provide read_img_ndarray.
  • If plugin name conflicts with a built-in backend name, built-in backend wins.
  • Built-in backends are listed first; additional and plugin backends are appended.

Install Local Rust/PyO3 Backend

Example installing a local backend crate into this project environment:

env -u CONDA_PREFIX \
  PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 \
  UV_CACHE_DIR=.uv-cache \
  /path/to/maturin develop --manifest-path /path/to/backend/Cargo.toml --uv

Then verify:

UV_CACHE_DIR=.uv-cache uv run imgread_benchmark libs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imgread_benchmark-0.3.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imgread_benchmark-0.3.1-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file imgread_benchmark-0.3.1.tar.gz.

File metadata

  • Download URL: imgread_benchmark-0.3.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for imgread_benchmark-0.3.1.tar.gz
Algorithm Hash digest
SHA256 41e55c14ac48b0ee12027579645ba297f1cfe1b43a17acf29dc3401f06716162
MD5 6f4e604bdce11011cc04ecbfadaf93a8
BLAKE2b-256 48a32251d1c74adffcaff23848f171e282372d4659ff834dbe574684e4f0eb9a

See more details on using hashes here.

File details

Details for the file imgread_benchmark-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: imgread_benchmark-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for imgread_benchmark-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d7f1dd82d300468c0c0e28bf6afdc50ab97ee3d26c6000726a2c6867d1179b5c
MD5 d08b7eeec5e150449503195c484c6019
BLAKE2b-256 83e8b171dc15aacd11ac7675b2dfb5138673695e97128bef48317472f5a6dbf6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page