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

Uploaded CPython 3.10+Windows x86-64

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

Uploaded CPython 3.10+Windows x86

img_gen-0.2.2-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.2-cp310-abi3-musllinux_1_2_i686.whl (14.0 MB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ i686

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

Uploaded CPython 3.10+macOS 11.0+ ARM64

img_gen-0.2.2-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.2.tar.gz.

File metadata

  • Download URL: img_gen-0.2.2.tar.gz
  • Upload date:
  • Size: 130.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.2.2.tar.gz
Algorithm Hash digest
SHA256 01f9b5359db63562fab32b5f1c49411314eda35f88b51492727ce7383337871a
MD5 b8633f87a1b7eed04ee4894bdf802683
BLAKE2b-256 121f40e48f2651572c955febcec51015c5dcfdd617b9f31299fb766ef5d9fa58

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: img_gen-0.2.2-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.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a14feb18367449725747b75df906f5a7a69b99ecbc04f13974f14bc9fcd879b9
MD5 8575f9f25df920c280e7f7884ce2a91f
BLAKE2b-256 c8b84ccd6cd95c579701ce7c344f73cf6d3dc856915c43f2684cd13a45ae8404

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: img_gen-0.2.2-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.2-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 438e9339ccda37bdc6cd13b0357c1a51bd09c29ddf4f3dffff7869a5160e4616
MD5 ae772eb8661b4cd392f2fe5d97692219
BLAKE2b-256 cdf51d1cb684c493dff703cfaa142299e090b3fd4650312815de926bdc26a002

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.2-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c915127ffc9b81008798317f18ef107e214fd17479cdc7f489a7156cc8184fed
MD5 1a6a3bac9e551eec3ca78895c8cd0ba1
BLAKE2b-256 76c535a5a16a3124844a3bb50f6e98595285cb48b80217a17f5b49ced9ce392f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.2-cp310-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 a33a700ab6ba42a9ad26d45fb26f252fbdb3ed439c6e84302426efb14418f76f
MD5 4325962ffb3d5db2754c8aa7bb079923
BLAKE2b-256 f621f15757cbc39a152cbb8228e83f981dd00c6b0cb1cbfed43d44cfbbc7e0ff

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.2-cp310-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 23823f71fbd48ab50ba10e821a0c2dc6131c259a8b69fdf31e9901139ba95b6f
MD5 e68035942f16ccc46c59c85ca5abd958
BLAKE2b-256 2b0a2c36503dba9cb59ba2cce9f8511ba325a83ad44ad88936c7c8e7ab450e40

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.2-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 bc6eb53a1d55db2f90e46c08a6bd3536b32e2f3de3f225ea4a70f1fdd895b18d
MD5 b1d3801874d45cdcdf423df0bccff926
BLAKE2b-256 685d0cae0b000e8a53737f2f1b7f4762fce8868915509c8798d75bb335398cee

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e2661309269e54ceefacbac8d9ebc684baf266c6f1b991ed1d03cfbfe0d5e596
MD5 0fea328f0fe50b06dbd67fd080466b04
BLAKE2b-256 3923114dd8215de017d783d1012717a03cca45281e529af9257eaabef6c453e7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.2-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 db992d92ae5c0d2c2a785b7b67c4f7a1c9438eae5b7bbbe66ad3a4de83887641
MD5 fe283e3f642faabf6579cf62ec55efd0
BLAKE2b-256 e92234a6bc662ed59700247d94193f88a509acccb77cce99eb4ce8e82917d124

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.2-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 bf278017f6cd9b572fc748c20fe67629cc520d809c2ada2e864ffc273d0bff65
MD5 710fd85587e333d50dc5bcf90ea3527c
BLAKE2b-256 f713770f66b0c4bbdded3bd00a1dd863258e4ed68089cb6539bdee1dfd819c98

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.2-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 86fdce7d584a2ac517311ad4370d0b5f1afc6f6a37bdc0be9ae080ebb7ed5ebb
MD5 0b0ab08d402358f4a5e6b1e45d4e6e25
BLAKE2b-256 8f694aef6cc2626c6f6d6ab4e58c6cacbfe8a09ff596afecee3bd742733ad356

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.2-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 49acf883bc62b6de7ae48eb8ea2df21390bee6540c7f3fb73832286b441166fd
MD5 553ffb15b5ca5af18ef13e14005d854f
BLAKE2b-256 dcb3ad9e3b1deb5fdacdba86db8ab117add87afa7c7f866a7ad160b4fecb6136

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 32caa0b3df7490c5d2791ccc2534481ecb21b64f1bb01940563ad99a3fea98d1
MD5 4fb8cd5154d6e47b9aa59a8d704c2d84
BLAKE2b-256 9eb22521f976097cfda4a11dc6af51a6a71114a06bd2f0e841933990bf76c60c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e7643654a2fa20fb5a5c9a33345b9d11ef69a17f7de004a6f5849cc23b97558b
MD5 437f8bb0130f73a2ff29cab38408524d
BLAKE2b-256 cb466b03c3a9dae4a90810a4140cbeaf43a4aef30c5e2ed1931e687ae1eba1f2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for img_gen-0.2.2-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3cc3830826b2fa2ca8259f429d0b7d84b2a4fc5906eacb1db7956971c21a6353
MD5 5b519b8262fdfe1706147a27c9b98e2c
BLAKE2b-256 1b27eb8abc05a7c2c5f31172a8bbf4a6707d837ff96a7884c9beb1a37ac823be

See more details on using hashes here.

Provenance

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