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.3.tar.gz (133.3 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.3-cp311-abi3-win_arm64.whl (12.3 MB view details)

Uploaded CPython 3.11+Windows ARM64

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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

img_gen-0.2.3-cp310-abi3-musllinux_1_2_x86_64.whl (13.1 MB view details)

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

img_gen-0.2.3-cp310-abi3-musllinux_1_2_i686.whl (12.8 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

img_gen-0.2.3-cp310-abi3-musllinux_1_2_armv7l.whl (11.7 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARMv7l

img_gen-0.2.3-cp310-abi3-musllinux_1_2_aarch64.whl (12.4 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

img_gen-0.2.3-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.1 MB view details)

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

img_gen-0.2.3-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.3-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.3-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (13.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ i686

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

img_gen-0.2.3-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.3.tar.gz.

File metadata

  • Download URL: img_gen-0.2.3.tar.gz
  • Upload date:
  • Size: 133.3 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.3.tar.gz
Algorithm Hash digest
SHA256 c8b798dcc4852aca35217ed2d586bc50601bf05d87fada50586e07915a7133b4
MD5 923b2973b75edea7d973fbe2f85507e5
BLAKE2b-256 baf6e8594f85a7222db6e99f72fa0e346e02fd27841ebd196fad7ccac7dae515

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.3.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.3-cp311-abi3-win_arm64.whl.

File metadata

  • Download URL: img_gen-0.2.3-cp311-abi3-win_arm64.whl
  • Upload date:
  • Size: 12.3 MB
  • Tags: CPython 3.11+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for img_gen-0.2.3-cp311-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 3cd23c81419e9d71bd36bba3d93d4accc6231d41814017b4a95df2ef88f31fcd
MD5 19a17eab797247a6b24b58474cfae3ac
BLAKE2b-256 82986d6d52eb60687466b4bc8d50bff1db6fcc92a6dd3430e7e5f548e994710a

See more details on using hashes here.

Provenance

The following attestation bundles were made for img_gen-0.2.3-cp311-abi3-win_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.3-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: img_gen-0.2.3-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.3-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f0542203dc8ff9fbad4ac55d8ec961a1e96ae3f07df40856583a84382b8fb2a9
MD5 0428064c9e78b5b3e0a2f320bfeb2de7
BLAKE2b-256 5e933e5e4f6acae29ddecc34bcd23a0924e62268b4d38b871ed5cb1a27cfc3c1

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: img_gen-0.2.3-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.3-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 c16f4062bc7bd2b00b4bdf1b84b171d362646b2aa9de874267132442b66f928c
MD5 5bf535fe5c4e155f8251787be3d84c7f
BLAKE2b-256 f862c9eb9da3999e8c9ec6089c7c5dcd1de5c080d40f05bd0c2a51c721d55006

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.3-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7ec744875baf6d7fbdcf6bb462b57d848d34e00606a24057644dee68b90b67fa
MD5 b40a9c0e55ce5766363490e1246b001d
BLAKE2b-256 052e780289b21491f4bb8e5596dfbc83ba959e01e0d99b95e64fca94343cb277

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.3-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 b944882dfb37835f0c2e5dee344ae180f8f00f00a680030730c9b2774aef4966
MD5 da2701185b162a515453bf1c503f8310
BLAKE2b-256 72b4007878a7a9e02162a9848dfe47a7ac6e544a060b6417c57a01bfc1b35a92

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.3-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 b00c9b6e5f4f884cc57bc17805149c05a2c9801b0e49edf7348f6a8867bd305c
MD5 34bf7ec964dd7631fd65f429fd95eb6d
BLAKE2b-256 a40a9a0e6268008838874aad6edf415103d7c479418114ca1152908297cdf243

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.3-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 98da080a8752e584c748056f3fd2dfa2a93e3bb274f50c97b830b381a06be0b8
MD5 d09ee83b168b93ff1143c6e1f17683a7
BLAKE2b-256 4f6e4bf92d67dc617a326936f164e6dfb59ddb05b3f67e9f9b3eb973134ae3a2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.3-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b35cbcb0a0df2e19719f72768fa472cd68df6bf65375e401a43d09e80c901dfb
MD5 4826a807de1c93267bf4dd24c663f82e
BLAKE2b-256 9fdb44c8ccb2161586161c964fb6a4068bc2eaa2bd6308aa112e6019553c459d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.3-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 1eeda71d4d996876b37457077fb2289c719fe9f14abeeb80f0683ab8b4db7503
MD5 2ac863c8c9a1b2db036629b05ab50696
BLAKE2b-256 63bf4a1798cf73d8170c94fd57bcaf2af3c1f83e8b694920a623f6e1f134900d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.3-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 0b74329883c10b57f1f84efb3ff4dff8a353d7d92ff7a545cfe65846347e9e48
MD5 42e21b1c24e5bec5e18fe9495c4434f3
BLAKE2b-256 dfa55ff646344d294d88cf83a9e65cb0681564a488181d570928d943188a83a0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.3-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 73ad95c624290b6d92e8806520d5384b0482118a9a585889fb29e4cd47388856
MD5 1c7fce5bc85fc3abc1348977e3c00eca
BLAKE2b-256 a9ad91d06f16cdbdbd30912adcfaa308087baf31d7724852d657a9e23b829f93

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.3-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 89931fc2833d31ca845f9baae406b1be2477270978806a136fa3ae18c49e1563
MD5 2e5bc08318155e386a360edb7d419dc4
BLAKE2b-256 1a4ea3da2dc30e750567eac68a44db4c6ca709fcd67007c15e6d572691164e3d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.3-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 25d2f1d6de08a98196fb6ed22dee2394ffa5565f670339cfd94414478a308e6f
MD5 3cd2ddb28da29fe5008da392f16726a4
BLAKE2b-256 1b3e77745b1aec8271cdec277f2a7b25bc016f3ac4fd21042ed42b80e2c7c375

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.3-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0b3875831db3b492a769c279370c7fefb8b72a41565049c2a111c42fcc4491e4
MD5 fac5cfa2734960ee2feb1b71cc5c6bda
BLAKE2b-256 1d02182199bf5bd45d6d8e8c60dda8624833d07f6777fc4502e0f316a110f637

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.3-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9bad8e8bb17176676f6586fbf90ad87c09320b5c2c6f4c4c1364d1dfa9a321e4
MD5 2e1b539cba9da824a08f8ca6551c9124
BLAKE2b-256 a06fdc7e883973925c3dc45206960296d51784bbe8b639b26889c504f71e9d0d

See more details on using hashes here.

Provenance

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