Skip to main content

Generic mathematical diagram generation library for any topic

Project description

ImageGen AI

A Python library for AI-powered image generation using Stable Diffusion models.

Features

  • Easy-to-use API for image generation
  • Support for batch generation
  • Memory management and optimization
  • Metadata support for generated images
  • Utility functions for image processing
  • Configurable settings

Installation

From PyPI (when published)

pip install imagegen-ai

From source

git clone <repository-url>
cd imagegen-ai
pip install -e .

Quick Start

from imagegen import ImageGenerator, save_image

# Initialize generator
generator = ImageGenerator()

# Generate an image
image = generator.generate(
    prompt="A beautiful sunset over mountains",
    width=512,
    height=512,
    seed=42
)

# Save the image
save_image(image, "sunset.png")

Advanced Usage

Batch Generation

prompts = [
    "A futuristic city",
    "A peaceful forest",
    "A vintage car"
]

images = generator.generate_batch(prompts)

Custom Configuration

from imagegen import Config

config = Config(
    model_id="runwayml/stable-diffusion-v1-5",
    device="cuda",
    default_width=768,
    default_height=768
)

generator = ImageGenerator(
    model_id=config.model_id,
    device=config.device
)

Creating Image Grids

from imagegen.utils import create_grid

# Generate multiple images
images = generator.generate_batch(prompts)

# Create a grid
grid = create_grid(images, grid_size=(2, 2))
save_image(grid, "image_grid.png")

API Reference

ImageGenerator

Main class for image generation.

Methods

  • generate(prompt, **kwargs) - Generate a single image
  • generate_batch(prompts, **kwargs) - Generate multiple images
  • change_model(model_id) - Switch to a different model
  • get_memory_usage() - Get current memory usage
  • clear_memory() - Clear GPU memory cache

Utility Functions

  • save_image(image, filename, directory, metadata) - Save a single image
  • save_images(images, base_filename, directory, metadata) - Save multiple images
  • create_grid(images, grid_size, spacing) - Create an image grid
  • batch_resize(images, size, method) - Resize multiple images

Requirements

  • Python 3.8+
  • PyTorch 1.13.0+
  • CUDA-capable GPU (recommended)

License

MIT License - see LICENSE file for details.

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

mathdiagram-1.0.1.tar.gz (39.2 kB view details)

Uploaded Source

Built Distribution

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

mathdiagram-1.0.1-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file mathdiagram-1.0.1.tar.gz.

File metadata

  • Download URL: mathdiagram-1.0.1.tar.gz
  • Upload date:
  • Size: 39.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for mathdiagram-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f0d9ea6e87044cc31a7f03df94734292341af7d1df7a822df8363a6af7557ee8
MD5 76186def78713d0a2dcb86a3076cbcf2
BLAKE2b-256 788544fdc645efe250b487ac874352c147c1d24f69954300c86fc3c7fed3c3c3

See more details on using hashes here.

File details

Details for the file mathdiagram-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: mathdiagram-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for mathdiagram-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7c43346ebeef2796a0bdba72eb8f4c0138026693a914b5462ada9da6c7a6735d
MD5 73e155adec3c68a80d7256e6073131b8
BLAKE2b-256 445144a403843cc72e0376c6930296f8a2b6ee771d4a5350c4120e74d023261e

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