---
name: anthropic-algorithmic-art
description: Create algorithmic and generative art using code. Use this skill when generating visual artwork through mathematical and computational processes, including fractals, geometric patterns, data visualizations, and generative compositions.
license: Complete terms in LICENSE.txt
---

# Algorithmic Art

A skill for creating generative and algorithmic art through code.

## Approaches

### 1. Mathematical Patterns
Use mathematical functions to create patterns:
- Sine/cosine waves for flowing patterns
- Perlin noise for organic textures
- Mandelbrot/Julia sets for fractals
- L-systems for plant-like structures
- Voronoi diagrams for cellular patterns

### 2. Geometric Compositions
Create structured geometric art:
- Tessellations and tilings
- Recursive subdivision
- Spiral and radial patterns
- Grid-based compositions
- Polygon packing

### 3. Stochastic Processes
Use randomness for generative art:
- Random walks
- Particle systems
- Agent-based drawing
- Monte Carlo methods
- Evolutionary algorithms

### 4. Data-Driven Art
Transform data into visual patterns:
- Audio waveform visualization
- Text-to-pattern generation
- Network graph visualization
- Time series as visual elements

## Implementation

### Using Python with Pillow
```python
from PIL import Image, ImageDraw
import math
import random

width, height = 2000, 2000
image = Image.new("RGB", (width, height), "white")
draw = ImageDraw.Draw(image)

# Example: geometric pattern
for i in range(1000):
    x = random.randint(0, width)
    y = random.randint(0, height)
    size = random.randint(5, 50)
    r = int(50 + 205 * (x / width))
    g = int(50 + 205 * (y / height))
    b = int(100 + 155 * ((x + y) / (width + height)))
    draw.ellipse([x, y, x + size, y + size], fill=(r, g, b))

image.save("generative_art.png")
```

### Using Python with matplotlib
```python
import matplotlib.pyplot as plt
import numpy as np

fig, ax = plt.subplots(figsize=(10, 10))
ax.set_aspect("equal")
ax.axis("off")

# Example: recursive tree
def draw_tree(x, y, angle, length, depth):
    if depth == 0:
        return
    x2 = x + length * np.cos(angle)
    y2 = y + length * np.sin(angle)
    ax.plot([x, x2], [y, y2], color="brown", lw=depth)
    draw_tree(x2, y2, angle - 0.5, length * 0.7, depth - 1)
    draw_tree(x2, y2, angle + 0.5, length * 0.7, depth - 1)

draw_tree(0, 0, np.pi/2, 1, 10)
plt.savefig("recursive_tree.png", dpi=300, bbox_inches="tight")
```

## Best Practices

- Use high resolution (2000x2000+) for print-quality output
- Include randomness seeds for reproducibility
- Layer elements to create depth and complexity
- Use color theory to create harmonious palettes
- Export in both PNG (for web) and high-DPI PNG (for print)
