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.0.tar.gz (129.6 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.0-cp310-abi3-win_amd64.whl (12.7 MB view details)

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

img_gen-0.2.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-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.0-cp310-abi3-macosx_11_0_arm64.whl (13.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

img_gen-0.2.0-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.0.tar.gz.

File metadata

  • Download URL: img_gen-0.2.0.tar.gz
  • Upload date:
  • Size: 129.6 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.0.tar.gz
Algorithm Hash digest
SHA256 8de14b411fd22a4167b545e128cfb54a0a62350b561cabd2f9691419bcddadca
MD5 e39d01f3628e46b1eecfae825709f51c
BLAKE2b-256 e4093bb722b6f8d2e089c00725ac43d3a559d4ebf3a165a2242e13a7086a9c1d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: img_gen-0.2.0-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.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 068166eee313113544498ddc93441b013fdafb6e570aa1f84da089113c201829
MD5 9fc892ebb162f5bb597b64e398f82503
BLAKE2b-256 011f99f329e384d5c0266d40d60cd8220f7877929f29b9cf9ef6786801214fab

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: img_gen-0.2.0-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.0-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 2d947dccb4e478c4645b9a3ac52b623d8ea08f96fca7d61b138f391a6c32a5ca
MD5 248c927748662b41e737993a52f891ed
BLAKE2b-256 797c0fdc819d0a7723b5f3566af8de06123c40eba3fe19db4618dcdf54faafcf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a20f6db0ce9e41bf85bd3ed67918de0e1ba5f04f5c550bf333a066b7159a74aa
MD5 932eb53c5202ffd3d1510e71cf841f79
BLAKE2b-256 e5e1a5148ee4a8de49419c1be6f6b8df3e123d09dd584c068305f5fe7694f626

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.0-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 92924ddfb27061c3a6f4b23287b616680d9d3c7e73039551c0c0a98a85b81f6d
MD5 6f3a78059bc90af5dac468933926d8ed
BLAKE2b-256 d67ff7a14e7025d0a770631e0cd87c96cff7c803a3e752e7f1442dc358c434f0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.0-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 5f917000d97eff4c795d28d9d05abe791cbe36bce8f4c1ed6e2fb1435ffcc7ce
MD5 bcc493dad29db0309777ef4d4ae2abc0
BLAKE2b-256 e7c8f65246572959205a89de044505d544c71a2a7f4cc02272233aa220e94e53

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 c5c870690592d0cb4692116dff9820f574673de44be51ab95b8d9716a8034741
MD5 ed0820db5d831786335a674b63aaa9b4
BLAKE2b-256 5e72c32db9d150ac6a1109f6eb04d33a332e5aa810affab4f2827f6dfb996477

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1e24c1d45d70a14261493d58bf614eb426e2f328e458eb12a96e55984a5476d7
MD5 9ee5a13bc7e47ab4db3dd3e9582e7e11
BLAKE2b-256 52eb2f73c83f6cf9e93369021f7a00416534dd76b093a355086675312b880808

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 4c432b8a4dedc1d032d67dc8c597a0c71753fb6dc3e3149e52e6d8db2e1c6713
MD5 a860b651cd8ffde3c83adabbeec3153e
BLAKE2b-256 950ae384bfdf352feaf430fa64cdb78219966c5c5b7be2799558f4a133060ca6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 83b9640017011c2a7523a73ff269ea5a01878a41953624c80cfb059fb61e4e31
MD5 b100d3fb91801005584dfac37804e2bc
BLAKE2b-256 ce8d92cf829237d5e0fdee765b6f4707b69c05d688c1eeedf6120296447265d6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.0-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 a3608d00cb42a36ca4ce607c0c2728737759e86686e604d0ad46cbe6d57ce5fd
MD5 e8a70456afaf30025b89373c5b964dbb
BLAKE2b-256 186379cff253e71fe9feec9b9ae05075883d46fc9e5d72603f86a005da00d03a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 312acc233676e8577ddaf6a4cb188cbf37febcf9bd7e61e61772509efbd4635c
MD5 f6ebece4c5853b001ab213608115e1aa
BLAKE2b-256 a60864cd9bff82010bc5fdb40079c83b13a1bc002c6febbec283f51c4abf9cbf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a834ac9ec0fdb515b320588ae07ddf37c914472f17523859acd588cb7bceb301
MD5 a4256a872a5e48350f36d1cdaef8d104
BLAKE2b-256 78b3ecb534661db23b7b6c3760abbc35ecd68aa05967cc2e35a3706dca1d4636

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 10f134d39e5d3893f6a0204a47af8e62c37945aca04a99257fae0d395f69be7b
MD5 54da9188882604e8d660ed44b78ded04
BLAKE2b-256 ab229f5553487d14464a1ec72fb7151619c18d56031636325cf1e341309e7380

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 dc3002c9e287b1339bc16c1daea21b2095ad88bfd99ea68fd61ad43153d28d3b
MD5 cd224294dfb4f05c9a2c43132b973674
BLAKE2b-256 e97e93a9a8d4f3de1d1e7a59a6356d7277dbf7c3ea99c220049de1ad80256c9d

See more details on using hashes here.

Provenance

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