Skip to content

Latest commit

Β 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Fractal Visualizer

High-Performance Fractal Generation and Wallpaper Creator

Generate stunning fractal visualizations including Mandelbrot sets, Julia sets, and other escape-time fractals. Features real-time parameter adjustment, multiple color palettes, and high-resolution export capabilities for creating beautiful wallpapers.

Fractal Examples

Features

Multiple Fractal Types

  • Mandelbrot Set - The classic fractal with infinite detail
  • Julia Sets - Beautiful variations with complex parameters
  • Burning Ship - Dramatic fractal resembling a ship
  • Extensible - Easy to add new fractal algorithms

🌈 Advanced Color Engine

  • Predefined Palettes - Classic, Fire, Ocean, Sunset, Cosmic, Electric, and more
  • Custom Gradients - Create your own color schemes
  • Smooth Coloring - Eliminates banding artifacts
  • Color Enhancement - Contrast, brightness, and saturation controls
  • Multiple Color Spaces - RGB, HSV, LAB support

High-Resolution Export

  • Multiple Resolutions - HD, Full HD, QHD, 4K, 8K support
  • Wallpaper Presets - Standard desktop and mobile sizes
  • Format Options - PNG, JPEG, WebP export
  • Batch Export - Generate multiple resolutions at once
  • Quality Controls - Compression and optimization settings

Performance Optimized

  • Numba JIT Compilation - Lightning-fast computation
  • Parallel Processing - Multi-core CPU utilization
  • Memory Efficient - Handles large images smoothly
  • Real-time Preview - Interactive parameter adjustment

🌐 Interactive Web Interface

  • Streamlit-based UI - Beautiful, intuitive interface
  • Real-time Generation - See changes instantly
  • Parameter Controls - Zoom, pan, color adjustments
  • Preset Points - Explore interesting fractal locations
  • Export Integration - Direct wallpaper generation

Quick Start

Installation

  1. Clone the repository

    git clone https://github.com/fractals/fractal-visualizer.git
    cd fractal-visualizer
  2. Install dependencies

    pip install -r requirements.txt
  3. Launch the web interface

    python main.py
  4. Open your browser to the displayed URL (usually http://localhost:8501)

Command Line Usage

# Launch web interface (default)
python main.py

# Generate sample wallpapers
python main.py --samples

# Show help
python main.py --help

πŸ“– Examples

Basic Mandelbrot Generation

from src.fractal_engine import FractalEngine, FractalConfig
from src.color_engine import ColorEngine, PaletteType
from src.export_engine import ExportEngine

# Create engines
fractal_engine = FractalEngine()
color_engine = ColorEngine()
export_engine = ExportEngine()

# Configure fractal
config = FractalConfig(
    width=1920, height=1080,
    max_iter=256, zoom=1.0
)

# Generate Mandelbrot set
iterations = fractal_engine.generate_mandelbrot(config)

# Apply colors
rgb_image = color_engine.apply_color_mapping(
    iterations, PaletteType.FIRE, smooth=True
)

# Export as wallpaper
export_engine.save_image(rgb_image, \"mandelbrot.png\")

Interactive Web Interface

The web interface provides:

  • Real-time fractal generation with parameter sliders
  • Multiple fractal types with easy switching
  • Color palette selection with live preview
  • Zoom and pan controls for exploration
  • Export options for multiple resolutions
  • Preset interesting points to explore

Web Interface

Batch Wallpaper Generation

# Generate wallpapers in multiple resolutions
resolutions = ['Full HD', 'QHD', '4K', 'Ultrawide 2K']
saved_files = export_engine.save_wallpaper_set(
    rgb_image, \"my_fractal\", resolutions
)

Color Palettes

Predefined Palettes

Palette Description Best For
Classic Traditional Mandelbrot colors Classic fractals
Fire Warm oranges and reds Dramatic effects
Ocean Cool blues and cyans Calm, flowing fractals
Sunset Purple to yellow gradient Artistic wallpapers
Cosmic Deep purples and violets Space-themed images
Electric Blue to white lightning High-contrast details
Monochrome Grayscale gradient Minimalist designs

Custom Palettes

# Create custom gradient
custom_palette = color_engine.create_gradient_palette(
    start_color=(0.1, 0.0, 0.2),  # Dark purple
    end_color=(1.0, 0.8, 0.3)     # Gold
)

# Apply to fractal
rgb_image = color_engine.apply_color_mapping(
    iterations, custom_palette
)

πŸ“ Resolution Presets

Desktop Wallpapers

  • HD: 1280Γ—720
  • Full HD: 1920Γ—1080
  • QHD: 2560Γ—1440
  • 4K: 3840Γ—2160
  • 8K: 7680Γ—4320

Ultrawide Support

  • Ultrawide 2K: 3440Γ—1440
  • Ultrawide 4K: 5120Γ—2160

Mobile Wallpapers

  • Mobile HD: 720Γ—1280
  • Mobile FHD: 1080Γ—1920
  • Mobile QHD: 1440Γ—2560

Custom Resolutions

# Any custom resolution
custom_config = FractalConfig(width=5000, height=3000)

πŸ” Interesting Fractal Locations

Mandelbrot Set Highlights

Location Coordinates Zoom Description
Overview (-0.5, 0.0) 1Γ— Classic full view
Seahorse Valley (-0.75, 0.1) 50Γ— Intricate seahorse patterns
Elephant Valley (0.25, 0.0) 100Γ— Elephant-like bulb detail
Lightning (-1.775, 0.0) 1000Γ— Lightning-like tendrils
Spiral (-0.7456, 0.113) 2000Γ— Beautiful spiral formations

Julia Set Favorites

# Beautiful Julia set parameters
julia_params = [
    {'c_real': -0.4, 'c_imag': 0.6},    # Spiral dragon
    {'c_real': -0.8, 'c_imag': 0.156},  # Lightning bolt
    {'c_real': 0.285, 'c_imag': 0.01},  # Flower pattern
    {'c_real': -0.123, 'c_imag': 0.745} # Crystal formation
]

πŸ› οΈ Advanced Usage

Performance Tuning

# For real-time exploration (faster)
preview_config = FractalConfig(
    width=800, height=600,
    max_iter=128
)

# For final wallpapers (higher quality)  
export_config = FractalConfig(
    width=3840, height=2160,
    max_iter=1024
)

Color Enhancement

# Apply post-processing effects
enhanced_image = color_engine.enhance_image(
    rgb_image,
    contrast=1.2,      # Increase contrast
    brightness=0.1,    # Slight brightness boost
    saturation=1.3     # More vivid colors
)

Custom Export Settings

# High-quality PNG export
export_config = ExportConfig(
    format=\"PNG\",
    compression_level=3,  # Lower = better quality
    optimize=True
)

# High-quality JPEG export
export_config = ExportConfig(
    format=\"JPEG\", 
    quality=98,
    optimize=True
)

Performance Benchmarks

Resolution Iterations Generation Time* File Size (PNG)
1920Γ—1080 256 ~2-5 seconds ~8-15 MB
2560Γ—1440 256 ~4-8 seconds ~15-25 MB
3840Γ—2160 512 ~15-30 seconds ~35-60 MB
7680Γ—4320 1024 ~60-120 seconds ~150-300 MB

*Times vary based on CPU and fractal complexity

πŸ—οΈ Project Structure

fractales/
β”œβ”€β”€ src/                          # Source code
β”‚   β”œβ”€β”€ fractal_engine/           # Core fractal computation
β”‚   β”‚   β”œβ”€β”€ core.py              # Mandelbrot, Julia, Burning Ship
β”‚   β”‚   └── __init__.py
β”‚   β”œβ”€β”€ color_engine/             # Color palettes and mapping
β”‚   β”‚   β”œβ”€β”€ palettes.py          # Color palette definitions
β”‚   β”‚   └── __init__.py
β”‚   β”œβ”€β”€ export_engine/            # Image export and formatting
β”‚   β”‚   β”œβ”€β”€ exporter.py          # High-res export functionality
β”‚   β”‚   └── __init__.py
β”‚   β”œβ”€β”€ web_interface/            # Streamlit web UI
β”‚   β”‚   β”œβ”€β”€ app.py               # Main Streamlit application
β”‚   β”‚   └── __init__.py
β”‚   └── __init__.py
β”œβ”€β”€ examples/                     # Example scripts
β”‚   β”œβ”€β”€ quick_start.py           # Basic Mandelbrot generation
β”‚   β”œβ”€β”€ julia_explorer.py        # Julia set variations
β”‚   └── deep_zoom.py             # High-resolution deep zooms
β”œβ”€β”€ tests/                        # Unit tests
β”œβ”€β”€ docs/                         # Documentation
β”œβ”€β”€ assets/                       # Images and resources
β”œβ”€β”€ output/                       # Generated wallpapers
β”‚   β”œβ”€β”€ wallpapers/              # Final wallpaper exports
β”‚   β”œβ”€β”€ previews/                # Low-res previews
β”‚   └── settings/                # Saved configurations
β”œβ”€β”€ main.py                       # Main entry point
β”œβ”€β”€ requirements.txt              # Python dependencies
β”œβ”€β”€ pyproject.toml               # Project configuration
└── README.md                    # This file

Dependencies

Core Dependencies

  • NumPy - Numerical computations
  • Numba - JIT compilation for performance
  • Matplotlib - Color mapping and palettes
  • Pillow - Image processing and export
  • Streamlit - Web interface

Optional Dependencies

  • SciPy - Advanced mathematical functions
  • OpenCV - Additional image processing
  • Plotly - Interactive plots
  • ImageIO - Animation support

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Development Setup

  1. Fork and clone the repository
  2. Create virtual environment
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\\Scripts\\activate
  3. Install development dependencies
    pip install -e .[dev]
  4. Run tests
    pytest

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Benoit Mandelbrot - For discovering the Mandelbrot set
  • Gaston Julia - For Julia set mathematics
  • NumPy/SciPy community - For excellent scientific computing tools
  • Streamlit team - For the beautiful web framework

πŸ“ž Support


**Happy fractal generation! **

About

Project to generate fractal images

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages