Skip to main content

A Python library that generates unique images based on a given seed or address. It also provides functionality to generate random addresses, which can be used to create random images.

Project description

Babylonian Image Library v0.1.4


PyPI Downloads GitHub top language GitHub release (latest by date) GitHub GitHub Repo stars GitHub watchers GitHub forks PyPI - Downloads PyPI PyPI - Format


Author and developer: A.A. Suvorov


Babylonian Image Library

The Babylonian Image Library is a Python library that generates unique images based on a given seed or address. The library uses SHA-256 hashing to create deterministic yet visually unique images. It also provides functionality to generate random addresses, which can be used to create random images.

Features

  • Deterministic Image Generation: Generate images based on a seed or address using SHA-256 hashing.
  • Random Address Generation: Create random addresses in the format RoomX:WallY:ShelfZ:VolumeA:BookB:PageC.
  • Image Saving: Save generated images to a file in PNG format.
  • Customizable Image Size: Set custom width and height for the generated images.

Installation

To use the Babylon Image Library, ensure you have the following dependencies installed:

  • Python 3.x
  • Pillow (PIL fork) for image manipulation.
pip install babylonian-image-library

Usage

Basic Example

from babylonian_image_library import BabylonianImageLibrary

# Create an instance of the library
library = BabylonianImageLibrary(width=800, height=600)

# Generate a random address
random_address = library.generate_random_address()
print(f"Random address: {random_address}")

# Save the generated image to a file
library.save_image(random_address, "random_image.png")
print("The image has been saved to 'random_image.png'")

Custom Seed

You can also generate an image using a custom seed:

# Generate an image using a custom seed
from babylonian_image_library import BabylonianImageLibrary

# Create an instance of the library
library = BabylonianImageLibrary()
custom_seed = "MyCustomSeed123"
library.save_image(custom_seed, "custom_image.png")
print("The image has been saved to 'custom_image.png'")

Image Generation Process

The image generation process works as follows:

  1. The input seed (or address) is hashed using SHA-256.
  2. The hash is used to generate RGB pixel values for the image.
  3. If the hash is exhausted, it is rehashed to continue generating pixel values.
  4. The resulting image is saved to a file.

Random Address Format

The random address is generated in the following format:

RoomX:WallY:ShelfZ:VolumeA:BookB:PageC

Where:

  • X is a random integer between 1 and 100.
  • Y is a random integer between 1 and 6.
  • Z is a random integer between 1 and 10.
  • A is a random integer between 1 and 10.
  • B is a random integer between 1 and 100.
  • C is a random integer between 1 and 1000.

API Reference

BabylonianImageLibrary(width=1920, height=1080)

  • width: The width of the generated image (default: 1920).
  • height: The height of the generated image (default: 1080).

Methods

  • generate_image(seed): Generates an image based on the provided seed.
  • get_image(address): Returns an image generated from the given address.
  • save_image(address, filename="output.png"): Saves the generated image to a file.
  • generate_random_address(): Generates a random address in the specified format.

Example Output

Running the script will generate a random address and save the corresponding image to a file:

Random address: Room42:Wall3:Shelf7:Volume5:Book23:Page456
The image has been saved to 'random_image.png'


Information for developers:

  • pip install setuptools twine wheel
  • pip install build
  • pip install --upgrade pip
  • python -m build
  • twine upload dist/*

Disclaimer of liability:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright:

--------------------------------------------------------
Licensed under the terms of the BSD 3-Clause License
(see LICENSE for details).
Copyright © 2018-2025, A.A. Suvorov
All rights reserved.
--------------------------------------------------------

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

babylonian_image_library-0.1.4.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

babylonian_image_library-0.1.4-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file babylonian_image_library-0.1.4.tar.gz.

File metadata

File hashes

Hashes for babylonian_image_library-0.1.4.tar.gz
Algorithm Hash digest
SHA256 0ca2377ee3bf239b264d985787f649eee38597a31aab193b6bab781d7fdc9273
MD5 76855b1330124d69d38b453da9e85825
BLAKE2b-256 e36d4dfef994a62bdd5741b852339d1ffc4bc3247e2600290891a1741003bcd0

See more details on using hashes here.

File details

Details for the file babylonian_image_library-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for babylonian_image_library-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 83d9c602097789f369db6ebe65885a5dec482024559136b873297a38e20ce036
MD5 701249b26df44f2e46f051287f371dba
BLAKE2b-256 c79c541b9d380937fe3f94a643d84f484759d8b65cbe97df8b0d268f72439bcf

See more details on using hashes here.

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