A Python-based creative visualization tool that combines cellular automata, Deep Dream effects, continuous zoom, and object morphing to create mesmerizing visual experiences from images and videos.
- Cellular automata-based image processing
- Deep Dream integration for enhanced visual effects
- Continuous zoom effects
- Object detection and morphing using YOLO and EfficientDet
- Support for both image and video input
- GPU acceleration support (CUDA)
- Stable Diffusion integration for object generation
- Face detection and landmark recognition
The gnarly package provides CA-only batch processing with minimal dependencies:
# Install minimal dependencies
pip install -r requirements-core.txt
# Run headless batch processing
python -m gnarly input.jpg -o output.mp4 --frames 300 --rule ConwayHeadless CLI Options:
python -m gnarly input.mp4 -o output.mp4 \
--frames 300 # Frame count (for images)
--rule Conway # CA rule: Conway, HighLife, Seeds, Custom, DivisorRule
--grid-scale 4 # CA cell size in pixels
--blend-alpha 0.3 # Blend factor for live cells
--fps 15 # Output FPS
--max-dimension 800 # Max frame dimension
The original main.py includes Deep Dream, object detection, and real-time controls:
# Install full dependencies (requires GPU)
pip install -r requirements.txt
# Run interactive mode
python main.py input_file [--output_file OUTPUT] [--creativity 0.5]Headless mode (minimal):
- Python 3.x
- numpy, opencv-python, Pillow, tqdm
Interactive mode (full):
- Python 3.x
- CUDA-capable GPU (recommended)
- See
requirements.txtfor full dependencies
- Clone this repository
- Install dependencies:
# For headless CA-only processing pip install -r requirements-core.txt # For full interactive mode with Deep Dream pip install -r requirements.txt
python main.py input_file [--output_file OUTPUT_FILE] [--deep_dream_iterations ITERATIONS] [--deep_dream_lr LEARNING_RATE] [--creativity CREATIVITY_LEVEL]input_file: Path to the input image or video file--output_file: (Optional) Path to the output video file. Defaults to input_name_dream.mp4 in keep/--deep_dream_iterations: (Optional) Number of Deep Dream iterations (default: 30)--deep_dream_lr: (Optional) Learning rate for Deep Dream (default: 0.02)--creativity: (Optional) Creativity level for object detection/morphing (0.0 to 1.0, default: 0.5)
During rendering, you can use the following keyboard controls to adjust parameters in real-time:
Space: Switch between different cellular automata rulesR: Reset the grid, image, and zoom settingsLeft/Right Arrow: Decrease/Increase grid scaleUp/Down Arrow: Increase/Decrease the divisor valueB/N: Increase/Decrease blend alpha (mixing between states)O: Toggle object detection and morphingZ: Toggle continuous zoom effect[/]: Decrease/Increase creativity levelEsc: Exit the program
- The program processes input media using cellular automata rules
- Deep Dream effects are applied to enhance visual patterns
- Object detection identifies interesting elements in the scene
- Stable Diffusion generates variations of detected objects
- Continuous zoom creates an infinite zoom effect
- All elements are combined into a seamless, evolving visual experience
gnarly/
__init__.py # Package marker, version
__main__.py # Entry point: python -m gnarly
cli.py # Argument parsing
config.py # Configuration dataclasses
core/
ca.py # Cellular automata rules and CAEngine
io.py # VideoReader/Writer classes
utils.py # blend_images, zoom_image
effects/
base.py # Effect protocol
ca_effect.py # CA overlay effect
runners/
headless.py # Batch processing loop
- Conway: Classic Game of Life (B3/S23)
- HighLife: Game of Life variant (B36/S23)
- Seeds: Explosive growth pattern (B2/S)
- Custom: Modified survival rules (B3/S234)
- DivisorRule: Neighbor count modulo divisor
This project was developed by Devin Venable in collaboration with AI assistance.
View all video examples on our video showcase page.
Here are some preview thumbnails of the outputs:
This project is open source and available under the MIT License.