Skip to main content

No project description provided

Project description

img-gen

Rust Python codecov

Generate images from a deterministic data structure.

This project is written in Rust but ships as a Python package also.

Distributions

Rust

name version docs
img-gen crates.io docs.rs
img-gen-renderer crates.io docs.rs
img-gen-spec crates.io docs.rs

Python

name version docs
img-gen PyPI gh-pages

Examples

The below examples use the following YAML doc as a file named example-layout.yml.

layers:
  - background:
      color: "#4051b5"
  - icon:
      image: material/cat
      color: white
    offset: { x: 100, y: 100 }
    size: { width: 100, height: 100 }

Python

import asyncio # the only supported async runtime in python
from pathlib import Path

# configure loggers before importing this lib
from img_gen import Layout, Generator

async def main():
    generator = Generator(
        # add any external image/font paths (file or dir) here
        external_resource_paths=[],
        cache_root=None,  # use default cache dir
    )

    layout = Layout.from_yaml_str(yaml_str)
    yaml_str = Path("example-layout.yml").read_text(encoding="utf-8")

    # Generator.render() is async
    img = await generator.render(layout)

    img_hash = img.sha256
    img.save(f"{img_hash}.png")

Rust

use img_gen::{Generator, Layout};
use serde::Deserialize;

#[tokio::main]
async fn main() {
    let external_resource_paths = vec![]; // not using external images/fonts
    let cache_root = None; // use default value
    let generator = Generator::new(external_resource_paths, cache_root).unwrap();

    // using safer/newer yaml deserializing crate `serde_saphyr`
    let yaml_str = std::fs::read("example-layout.yml").unwrap();
    let layout: Layout = serde_saphyr::from_str(&yaml_str).unwrap();

    let img = generator.render(layout).await.unwrap();

    let img_hash = img.get_sha256().unwrap();
    img.save(format!("{img_hash}.png").as_str()).unwrap();
}

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

img_gen-0.2.1.tar.gz (129.7 kB view details)

Uploaded Source

Built Distributions

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

img_gen-0.2.1-cp310-abi3-win_amd64.whl (12.7 MB view details)

Uploaded CPython 3.10+Windows x86-64

img_gen-0.2.1-cp310-abi3-win32.whl (12.1 MB view details)

Uploaded CPython 3.10+Windows x86

img_gen-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl (14.5 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

img_gen-0.2.1-cp310-abi3-musllinux_1_2_i686.whl (13.9 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

img_gen-0.2.1-cp310-abi3-musllinux_1_2_armv7l.whl (13.4 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

img_gen-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl (14.1 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

img_gen-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

img_gen-0.2.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (13.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ s390x

img_gen-0.2.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (15.5 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64le

img_gen-0.2.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (13.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ i686

img_gen-0.2.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (11.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

img_gen-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (12.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

img_gen-0.2.1-cp310-abi3-macosx_11_0_arm64.whl (13.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

img_gen-0.2.1-cp310-abi3-macosx_10_12_x86_64.whl (13.2 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file img_gen-0.2.1.tar.gz.

File metadata

  • Download URL: img_gen-0.2.1.tar.gz
  • Upload date:
  • Size: 129.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for img_gen-0.2.1.tar.gz
Algorithm Hash digest
SHA256 092670820c085e497aa6bdf599d342ffca9d66e97426f7ac9b9a6761f1805615
MD5 fe1167ebc227d255474a39dfaceaa5ef
BLAKE2b-256 1a6462382515618ad8b4123586035777f17d9ab880ffd4d3326ec14475abc6b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1.tar.gz:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: img_gen-0.2.1-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 12.7 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5ca907e3c755b19e23caf1b66922b79914cd1f95cf80037fee01abb7cea601ad
MD5 8dcff563aebd2981847101178b38aa3a
BLAKE2b-256 d176e4a781b6a66bc55c7b6b2a26ab7f6cc586e08b710f0b1ba3978820a4dc25

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-win_amd64.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-win32.whl.

File metadata

  • Download URL: img_gen-0.2.1-cp310-abi3-win32.whl
  • Upload date:
  • Size: 12.1 MB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 f334fd41fae4b0609ac35150325490b68beccfb968070b95ea4bee4a68a82477
MD5 f5a1c04d1d1fd8bf932d75c0f7be9aff
BLAKE2b-256 a26bef1cc26be00dd25f36c5182fe69bf592b39be3e3ba3130fc403be48a7662

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-win32.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 025f9a0bfc5295124b46fcd523a1099c58cc711dea1ae1cbabb5873f96cb004f
MD5 2dc5553f068b9e3f18688f543e187b99
BLAKE2b-256 0703bd2ed37df6aa06e95308a67bc8eff4ff0d7a92fcdc74085bbe1d2a79209c

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-musllinux_1_2_x86_64.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 7a41176d0ec47203a36b96b6c8bf5cb24cc2ca002800caf9cc11d6af4a227090
MD5 a48f9b8f4d89e97c4ca722b1a79654d3
BLAKE2b-256 366cfe9a16c9f5e872f5c6ae0baaa859df46639771a195afd7740d700e1a0eec

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-musllinux_1_2_i686.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 bd033e41f66a600b2ee89c103410fec0efdaec83c1aa57ca18145c84e1a02e23
MD5 d276dc4cdede8fbf566f134eff092123
BLAKE2b-256 2ce1f4a46c533dba817b4d9902b781d9056d1a39571bf568f191d0999594d44f

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-musllinux_1_2_armv7l.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 355a6b857a6b577bc22724329b9005e79b0c86045c3d3d2fb7fdc6aedca8cb5e
MD5 ce96b3127b2fd39a5bbd1747be8cd960
BLAKE2b-256 f185e989e9b558141d50d9d9f68b8e044e817126671b3e6728d3e426403e2353

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-musllinux_1_2_aarch64.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf4c419a9c55662145f60981d576a0d4cae81346e2c46161d872245edc2fdf8d
MD5 f225aa8e0cbf09af64fced659a9d93df
BLAKE2b-256 23854c42bdc9401f6fe485ab93c10eed1ac1c78641f3f086948366bf07283119

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 7591ddd324d84b0603aacb382afe095c110bec1d92341d223646f6002a4a4e02
MD5 606a474d91333776a6717a329051b0fb
BLAKE2b-256 2f6a263340bd25590ef00e509f79d39593dae3ad9016003910c2f38b5aeeac48

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 b80b5cef904630428e0756329cf70cda8e2aa8f09a75df0f2ac7203380605e2b
MD5 b240ed7c7689611ffae8376f2810836a
BLAKE2b-256 f66ee8ed1e9663c326e90065a3328e117d373581d21637f15cf12dbd0f58581f

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 7a332876f956baa79b1cf5d23d337df085459bf08f12a708a524ab641e80b6cf
MD5 8dd7942d8adc5f05f7ded64e9366ecdf
BLAKE2b-256 6beeae79eb12a5e8c6bd4e2bda3b61c874f50bad49d0723f55f21ad5a7f6f07d

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 48e1b558b62a7e6c472bfe03951dfc8df135f5fbd5a456d838f1e798ff42ee37
MD5 8d62b7b2c8b4b0fb0831d5afa96427ee
BLAKE2b-256 77379cbe71e0b86b5a7ceb381b475223083377cb3b9e4a3086677aa5de44aa98

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ca511a32f652086f60af45a857abb315629c6e858663ebc24dc60ceefc1e2c68
MD5 0ee4dbd6cfce4441c9edf7f85d9edc16
BLAKE2b-256 2210738eef6503d4cb31e5d0fe650ad75503068a82e11fff4030cca326d497e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6d52d59e7378600771fd671129280de39e672041a1de6e997e10b7e0d8cc56ee
MD5 3cd19d41bbf4c19cb7d1f200448b29d9
BLAKE2b-256 03571f36d99005efb99a2a6f295e95e4b03d2e41cac4245d8df77714b8972de8

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file img_gen-0.2.1-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for img_gen-0.2.1-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7a7ae74d4e7c84dc12efc51e74a2ec11a96ed3af1b5878af8a7d09b2f98efd20
MD5 162d78233911cb07866adebafc2b91aa
BLAKE2b-256 39dc24e3dd0d30dd1b98b956715edfcab461da2115c01ca378ae098a064ebc8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.1-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: python.yml on 2bndy5/img-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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