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.1.0.tar.gz (126.8 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.1.0-cp310-abi3-win_amd64.whl (12.5 MB view details)

Uploaded CPython 3.10+Windows x86-64

img_gen-0.1.0-cp310-abi3-win32.whl (12.0 MB view details)

Uploaded CPython 3.10+Windows x86

img_gen-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl (14.3 MB view details)

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

img_gen-0.1.0-cp310-abi3-musllinux_1_2_i686.whl (13.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

img_gen-0.1.0-cp310-abi3-musllinux_1_2_armv7l.whl (13.2 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

img_gen-0.1.0-cp310-abi3-musllinux_1_2_aarch64.whl (14.0 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

img_gen-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.9 MB view details)

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

img_gen-0.1.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (13.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ s390x

img_gen-0.1.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (15.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ppc64le

img_gen-0.1.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (13.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ i686

img_gen-0.1.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (11.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

img_gen-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (12.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

img_gen-0.1.0-cp310-abi3-macosx_11_0_arm64.whl (12.9 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

img_gen-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl (13.0 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: img_gen-0.1.0.tar.gz
  • Upload date:
  • Size: 126.8 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.1.0.tar.gz
Algorithm Hash digest
SHA256 59f18d4c2a44cb577db5ac1b22492caddc2afcf469ae33e1b3b1ebb9359b34c3
MD5 50fe0370bab50f412876988583329bfc
BLAKE2b-256 0463f582999b1e3e74e0d40b8f69177191f524cd3a5a950db1c25f6c9ce3d012

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0.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.1.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: img_gen-0.1.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 12.5 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.1.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c0799883d9ffb0ebc3807d0daff8c46a258695e5fc3f4a41f0ebb3c4cd3a1864
MD5 1608eebf479a3307b7218d5b334dcc32
BLAKE2b-256 586d750619a81fbabea37316664e8399eead4adc154db4a2055d7954646774a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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.1.0-cp310-abi3-win32.whl.

File metadata

  • Download URL: img_gen-0.1.0-cp310-abi3-win32.whl
  • Upload date:
  • Size: 12.0 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.1.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 5395653812f89d61989373e56c7f00a5f6f62efa09d4fbfb78c944b70f8c1f2d
MD5 96a76784369b6f6d01085df0b1fe640e
BLAKE2b-256 1cf2d5cb1cf36f12823f2096be70c18d95694321341e39d31de39970c1cffec4

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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.1.0-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for img_gen-0.1.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 71488854a3a8a8360f3674b4eca66724c8544bb19bd7f020d59ca5640a804022
MD5 8ed0946dea601c982cc4133a16507cb5
BLAKE2b-256 c4ee23f2ffb45386027e568698a0dbd2243c1c9b019c3fecb9a9edb03ed31a71

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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.1.0-cp310-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for img_gen-0.1.0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 eba294a2d0d415e2960d9625647c2b747161d9d0e9101a99679b72ee7e11d818
MD5 168501adb4e31bd1b4a2327e1d2d570f
BLAKE2b-256 b8e1ca31e88eaf747987843a1f3818f1ea55d5ee5944369cab80f819c14417be

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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.1.0-cp310-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for img_gen-0.1.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 e1dc2b989f5ea3978934510b1d6d16eac6239d151d956c02969b53f4b0f6adc0
MD5 e03331ff296e2d4ff65796c78319bafa
BLAKE2b-256 7f49013557dd4251600845d41b28112d940d1abdfab274a878e6c42d463457fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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.1.0-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for img_gen-0.1.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 8c67476abbb8070d1b10041fafd5088da576e7e3a30acd25362e6da7b65d90c9
MD5 688b88b77dec81dd330ec7877ce56c16
BLAKE2b-256 5f52411837e31817786e85877b5c232c87b9ad75595cf1bb17cc61ffd6bf1d2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for img_gen-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b53cc93f9f94b2a5d9b3ee506ba6541fb5028e09c4e68334be12c8343660a9cb
MD5 c0c4d285d76917db722ef02e57f1d09f
BLAKE2b-256 174d556728b93dc7cf271b7bba2237c741e407842b6055a0dde4e2f553bcd4c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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.1.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for img_gen-0.1.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 831963f31883e311ffe596539abf914f43a8d7619a4ac58facf3c97f3edd707a
MD5 2fad857eb09b4f48b77044510063b301
BLAKE2b-256 2242d7025f023902728282f2240a9097a366686fc76b2a1f34119fddd22fd34e

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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.1.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for img_gen-0.1.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 5dab75b1dba0d977b7f77be7cedb06f5ce124031a0357265e5f0d96c0edb3a40
MD5 e9b8a9a440aa693eaeadd160a9b7b338
BLAKE2b-256 70a24eaa838fb3b36dd87d61f273e370c166fd34bfb1e168eb6ba6d613b6ca73

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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.1.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for img_gen-0.1.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 fa0f1be896e0bd9f979767f3dd5849bc5be150dabbe87136fe725829ffe9e5d2
MD5 17fdaa6859a6f6c1dbf4f2955b98bceb
BLAKE2b-256 703296946c2f0670a4ffc4378a9eccb0c0b6f4affddf4481460a434e14ab56ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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.1.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for img_gen-0.1.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 7e9512a34375f1d07f79872b32dc49c6eb765ea05552b593028d8fcf3749c4dc
MD5 0dee055ae7ac50cf7bb1d488467da2b6
BLAKE2b-256 92bf21b52c6ddfcc1452fd19ff2fe2ea4e4cc47905317530b6722598c9152bfb

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for img_gen-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e87c08689ff4f268c3f00d257f379ebdb9877fa241c94262a5266d1d84317cb6
MD5 7edb227ed3e73502859c000dfc6d155f
BLAKE2b-256 70fee698934fa53a699aa1065b6442134c041e32625f586c10ca671a79c8c47a

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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.1.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for img_gen-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9308d12f65a47582e37832c87773a16b2a5d5e7b98b9a8c7359f5c99504c0e3d
MD5 30671c51a8e988c1746847b85462f2a2
BLAKE2b-256 b807910d2a64d58e410b7522222a1ab1ff057a42265cd56ca3e60c4283510383

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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.1.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for img_gen-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 dfa398686b7f3705ad91308a56c98bc2fa9ceda52779afa395fe8759f9a0b852
MD5 2294dd6eda04a38c598ff87034b3cabe
BLAKE2b-256 613a3900cc4050977c27a6525e7459cfc4f57c1e9ca1e40aec5e59e6e402f4b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.1.0-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