Improvements and notebooks

This commit is contained in:
Andras Schmelczer 2026-04-26 21:05:16 +01:00
commit 520f959e50
34 changed files with 2669 additions and 1374 deletions

View file

@ -30,7 +30,7 @@ python3 display.py --saturation 1.5 --contrast 1.1 --gamma 0.85
4. Sends to e-ink display driver
**`src/lib/immich.py`** — Immich API client. Key behaviors:
- `PhotoHistory` tracks displayed photos in `photo_history.json` to avoid repeats (resets after 7 days). Asset is only marked displayed after a successful download.
- `_load_history()` / `_save_history()` track displayed photos in `photo_history.json` to avoid repeats (resets after 7 days). Asset is only marked displayed after a successful download.
- `_pick_weighted_random()` biases selection: 20% favorites, 50% recently-added (last 30 days, by Immich `createdAt`), otherwise uniform random
- Filters photos by orientation (portrait/landscape) based on EXIF data including rotation tags. Raises if nothing matches the requested orientation.
- Downloads preview-size thumbnails, not originals
@ -49,6 +49,13 @@ python3 display.py --saturation 1.5 --contrast 1.1 --gamma 0.85
**`src/lib/progress.py`** — Simple terminal progress bar.
**`notebooks/`** — Off-Pi observable comparisons covering pipeline stages. Run via the
uv-managed env (`uv run jupyter lab notebooks/...`). The notebooks share `_helpers.py`
(bootstrap, Immich client, pool fetch, image cache) and `_dither.py` (migrated from the
former `dither_test/`):
- `crop_compare.ipynb` — face-aware crop vs. centre crop on the most-divergent picks
- `dither_compare.ipynb` — error-diffusion + ordered dithering algorithms with timing
## Key Constraints
- **Always call `epd.sleep()` after display** — the driver uses a try/finally pattern for this

View file

@ -1,164 +0,0 @@
# Dithering Test Suite
Local testing suite for comparing dithering algorithms on the 6-color e-ink display.
## Setup
```bash
cd dither_test
pip install pillow numpy
```
For the interactive preview (optional):
```bash
# Tkinter is usually included with Python
# On Debian/Ubuntu if missing:
sudo apt-get install python3-tk
```
## Quick Start
### Compare all algorithms
```bash
python compare.py photo.jpg --html
# Open dither_output/photo_report.html in browser
```
### Interactive preview
```bash
python preview.py photo.jpg
# Use arrow keys to cycle through algorithms
```
## Tools
### `compare.py` - Batch Comparison Tool
Generate comparison outputs for multiple dithering algorithms.
```bash
# Compare all algorithms, save individual images
python compare.py image.jpg
# Compare specific algorithms only
python compare.py image.jpg -a floyd_steinberg atkinson jarvis
# Generate visual grid comparison
python compare.py image.jpg --grid
# Generate HTML report (recommended)
python compare.py image.jpg --html
# Side-by-side comparison of two algorithms
python compare.py image.jpg --side-by-side atkinson pil_fs
# With rotation
python compare.py image.jpg --html -r 90
# List available algorithms
python compare.py --list
```
### `preview.py` - Interactive Preview
Real-time preview with keyboard navigation.
```bash
python preview.py image.jpg
```
**Keyboard shortcuts:**
- `←` / `→` or `A` / `D` - Cycle through algorithms
- `R` - Rotate image (0° → 90° → 180° → 270°)
- `S` - Save current result
- `O` - Open new image
- `Q` or `Esc` - Quit
### `dither_algorithms.py` - Algorithm Library
Use in your own scripts:
```python
from dither_algorithms import apply_dithering, get_algorithm_names
from PIL import Image
img = Image.open('photo.jpg')
dithered = apply_dithering(img, 'atkinson')
dithered.save('output.png')
# List all algorithms
print(get_algorithm_names())
```
## Available Algorithms
### Error Diffusion (spread quantization error to neighbors)
| Algorithm | Description |
|-----------|-------------|
| `floyd_steinberg` | Classic (1976), good balance of speed and quality |
| `floyd_steinberg_weighted` | With perceptual color weighting |
| `atkinson` | Bill Atkinson (Apple), cleaner with 75% error diffusion |
| `atkinson_weighted` | Atkinson with perceptual weighting |
| `jarvis` | Jarvis-Judice-Ninke, smoother gradients, slower |
| `stucki` | Similar to JJN with modified weights |
| `sierra` | Full Sierra, balanced results |
| `sierra_lite` | Faster Sierra variant |
| `burkes` | Simplified two-row diffusion |
### Ordered Dithering (threshold matrix pattern)
| Algorithm | Description |
|-----------|-------------|
| `bayer2` | 2×2 Bayer matrix, visible pattern |
| `bayer4` | 4×4 Bayer matrix, common choice |
| `bayer8` | 8×8 Bayer matrix, finer pattern |
| `bayer4_strong` | 4×4 with increased strength |
### PIL Built-in (for reference)
| Algorithm | Description |
|-----------|-------------|
| `none` | No dithering, nearest color only |
| `pil_fs` | PIL's Floyd-Steinberg implementation |
## Recommendations
For **photographic images**: `atkinson` or `floyd_steinberg_weighted`
- Better color accuracy, smoother gradients
For **graphics/illustrations**: `bayer4` or `bayer8`
- Consistent patterns, no "wormy" artifacts
For **high contrast images**: `atkinson`
- Cleaner edges, less noise in solid areas
For **fastest processing**: `sierra_lite` or `pil_fs`
- Good quality with faster execution
## Output
Results are saved to `dither_output/` by default:
```
dither_output/
├── photo_source.png # Prepared source (800×480)
├── photo_atkinson.png # Each algorithm result
├── photo_floyd_steinberg.png
├── ...
├── photo_grid.png # Grid comparison (--grid)
└── photo_report.html # HTML report (--html)
```
## 6-Color Palette
The e-ink display uses these colors:
| Color | RGB |
|--------|-----|
| Black | (0, 0, 0) |
| White | (255, 255, 255) |
| Yellow | (255, 255, 0) |
| Red | (255, 0, 0) |
| Blue | (0, 0, 255) |
| Green | (0, 255, 0) |

View file

@ -1,16 +0,0 @@
# Dithering Test Suite for 6-Color E-Ink Display
from .dither_algorithms import (
apply_dithering,
get_algorithm_names,
DITHER_ALGORITHMS,
PALETTE_RGB,
PALETTE_NAMES,
)
__all__ = [
'apply_dithering',
'get_algorithm_names',
'DITHER_ALGORITHMS',
'PALETTE_RGB',
'PALETTE_NAMES',
]

View file

@ -1,512 +0,0 @@
#!/usr/bin/env python3
"""
Dithering Comparison Tool for 6-Color E-Ink Display
Generates side-by-side comparisons of different dithering algorithms
to help select the best option for your images.
Usage:
python compare.py image.jpg # Compare all algorithms
python compare.py image.jpg -a floyd_steinberg atkinson # Compare specific
python compare.py image.jpg --grid # Generate grid comparison
python compare.py image.jpg --html # Generate HTML report
python compare.py --list # List available algorithms
"""
import argparse
import os
import sys
import time
from pathlib import Path
from typing import List, Optional
from PIL import Image
from dither_algorithms import (
DITHER_ALGORITHMS,
apply_dithering,
get_algorithm_names,
PALETTE_RGB,
)
# Display dimensions
DISPLAY_WIDTH = 800
DISPLAY_HEIGHT = 480
def prepare_image(image_path: str, orientation: int = 0) -> Image.Image:
"""Load and prepare image for the display dimensions."""
img = Image.open(image_path).convert('RGB')
# Apply rotation
if orientation == 90:
img = img.transpose(Image.Transpose.ROTATE_270)
elif orientation == 180:
img = img.transpose(Image.Transpose.ROTATE_180)
elif orientation == 270:
img = img.transpose(Image.Transpose.ROTATE_90)
# Calculate scaling to fit display
target_w, target_h = DISPLAY_WIDTH, DISPLAY_HEIGHT
scale = min(target_w / img.width, target_h / img.height)
new_w = int(img.width * scale)
new_h = int(img.height * scale)
# Resize with high-quality resampling
img = img.resize((new_w, new_h), Image.Resampling.LANCZOS)
# Center on white canvas
canvas = Image.new('RGB', (target_w, target_h), (255, 255, 255))
x = (target_w - new_w) // 2
y = (target_h - new_h) // 2
canvas.paste(img, (x, y))
return canvas
def run_comparison(
image_path: str,
algorithms: Optional[List[str]] = None,
output_dir: str = 'dither_output',
orientation: int = 0,
) -> dict:
"""
Run dithering comparison and save results.
Returns dict with algorithm names as keys and tuples of (output_path, duration) as values.
"""
if algorithms is None:
algorithms = get_algorithm_names()
# Prepare output directory
output_path = Path(output_dir)
output_path.mkdir(parents=True, exist_ok=True)
# Get base name for outputs
base_name = Path(image_path).stem
# Load and prepare source image
print(f"Loading and preparing: {image_path}")
source = prepare_image(image_path, orientation)
# Save prepared source for reference
source_out = output_path / f"{base_name}_source.png"
source.save(source_out)
print(f" Saved prepared source: {source_out}")
results = {}
for algo_name in algorithms:
if algo_name not in DITHER_ALGORITHMS:
print(f" Warning: Unknown algorithm '{algo_name}', skipping")
continue
algo_info = DITHER_ALGORITHMS[algo_name]
print(f" Processing: {algo_info['name']}...", end=' ', flush=True)
start_time = time.time()
dithered = apply_dithering(source, algo_name)
duration = time.time() - start_time
out_file = output_path / f"{base_name}_{algo_name}.png"
dithered.save(out_file)
results[algo_name] = (str(out_file), duration)
print(f"{duration:.2f}s -> {out_file}")
return results
def create_comparison_grid(
image_path: str,
algorithms: Optional[List[str]] = None,
output_dir: str = 'dither_output',
orientation: int = 0,
cols: int = 3,
) -> str:
"""Create a single image with all algorithms in a grid layout."""
if algorithms is None:
algorithms = get_algorithm_names()
output_path = Path(output_dir)
output_path.mkdir(parents=True, exist_ok=True)
base_name = Path(image_path).stem
source = prepare_image(image_path, orientation)
# Calculate grid dimensions
n_images = len(algorithms) + 1 # +1 for source
rows = (n_images + cols - 1) // cols
# Thumbnail size (scaled down for grid)
thumb_w = DISPLAY_WIDTH // 2
thumb_h = DISPLAY_HEIGHT // 2
padding = 10
label_height = 30
# Create grid canvas
grid_w = cols * (thumb_w + padding) + padding
grid_h = rows * (thumb_h + label_height + padding) + padding
grid = Image.new('RGB', (grid_w, grid_h), (240, 240, 240))
# Import for text rendering
try:
from PIL import ImageDraw, ImageFont
draw = ImageDraw.Draw(grid)
try:
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 16)
except:
font = ImageFont.load_default()
except ImportError:
draw = None
font = None
def add_to_grid(img: Image.Image, label: str, idx: int):
row = idx // cols
col = idx % cols
x = padding + col * (thumb_w + padding)
y = padding + row * (thumb_h + label_height + padding)
# Resize for thumbnail
thumb = img.resize((thumb_w, thumb_h), Image.Resampling.LANCZOS)
grid.paste(thumb, (x, y + label_height))
# Add label
if draw:
draw.text((x + 5, y + 5), label, fill=(0, 0, 0), font=font)
# Add source image first
add_to_grid(source, "Original (Prepared)", 0)
# Process and add each algorithm
for i, algo_name in enumerate(algorithms, 1):
if algo_name not in DITHER_ALGORITHMS:
continue
algo_info = DITHER_ALGORITHMS[algo_name]
print(f" Grid: {algo_info['name']}...")
dithered = apply_dithering(source, algo_name)
add_to_grid(dithered, algo_info['name'], i)
# Save grid
grid_file = output_path / f"{base_name}_grid.png"
grid.save(grid_file)
print(f"Grid saved: {grid_file}")
return str(grid_file)
def create_side_by_side(
image_path: str,
algo1: str,
algo2: str,
output_dir: str = 'dither_output',
orientation: int = 0,
) -> str:
"""Create a side-by-side comparison of two algorithms."""
output_path = Path(output_dir)
output_path.mkdir(parents=True, exist_ok=True)
base_name = Path(image_path).stem
source = prepare_image(image_path, orientation)
info1 = DITHER_ALGORITHMS[algo1]
info2 = DITHER_ALGORITHMS[algo2]
print(f" Processing {info1['name']}...")
img1 = apply_dithering(source, algo1)
print(f" Processing {info2['name']}...")
img2 = apply_dithering(source, algo2)
# Create side-by-side
padding = 20
label_h = 40
width = DISPLAY_WIDTH * 2 + padding * 3
height = DISPLAY_HEIGHT + padding * 2 + label_h
canvas = Image.new('RGB', (width, height), (240, 240, 240))
canvas.paste(img1, (padding, padding + label_h))
canvas.paste(img2, (DISPLAY_WIDTH + padding * 2, padding + label_h))
# Add labels
try:
from PIL import ImageDraw, ImageFont
draw = ImageDraw.Draw(canvas)
try:
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 20)
except:
font = ImageFont.load_default()
draw.text((padding + 10, padding + 5), info1['name'], fill=(0, 0, 0), font=font)
draw.text((DISPLAY_WIDTH + padding * 2 + 10, padding + 5), info2['name'], fill=(0, 0, 0), font=font)
except ImportError:
pass
out_file = output_path / f"{base_name}_{algo1}_vs_{algo2}.png"
canvas.save(out_file)
print(f"Side-by-side saved: {out_file}")
return str(out_file)
def generate_html_report(
image_path: str,
results: dict,
output_dir: str = 'dither_output',
) -> str:
"""Generate an HTML report for easy comparison."""
output_path = Path(output_dir)
base_name = Path(image_path).stem
html = f"""<!DOCTYPE html>
<html>
<head>
<title>Dithering Comparison: {base_name}</title>
<style>
body {{
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #1a1a2e;
color: #eee;
margin: 0;
padding: 20px;
}}
h1 {{ color: #00d9ff; margin-bottom: 10px; }}
.subtitle {{ color: #888; margin-bottom: 30px; }}
.grid {{
display: grid;
grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
gap: 20px;
}}
.card {{
background: #16213e;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}}
.card img {{
width: 100%;
height: auto;
display: block;
cursor: pointer;
transition: transform 0.2s;
}}
.card img:hover {{ transform: scale(1.02); }}
.card-info {{
padding: 15px;
}}
.card-title {{
font-size: 18px;
font-weight: 600;
color: #00d9ff;
margin-bottom: 5px;
}}
.card-desc {{
font-size: 13px;
color: #888;
margin-bottom: 8px;
}}
.card-time {{
font-size: 12px;
color: #666;
}}
.source-card {{
grid-column: 1 / -1;
max-width: 850px;
}}
.source-card img {{ max-width: 800px; }}
.palette {{
display: flex;
gap: 10px;
margin: 20px 0;
padding: 15px;
background: #16213e;
border-radius: 8px;
width: fit-content;
}}
.color-swatch {{
width: 40px;
height: 40px;
border-radius: 6px;
border: 2px solid #333;
}}
.fullscreen {{
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.95);
z-index: 1000;
justify-content: center;
align-items: center;
}}
.fullscreen img {{
max-width: 95%;
max-height: 95%;
}}
.fullscreen.active {{ display: flex; }}
</style>
</head>
<body>
<h1>Dithering Algorithm Comparison</h1>
<p class="subtitle">Source: {image_path}</p>
<h3>6-Color Palette</h3>
<div class="palette">
"""
for i, (color, name) in enumerate(zip(PALETTE_RGB, ['Black', 'White', 'Yellow', 'Red', 'Blue', 'Green'])):
r, g, b = color
html += f' <div class="color-swatch" style="background: rgb({r},{g},{b});" title="{name}"></div>\n'
html += """ </div>
<h3>Results</h3>
<div class="grid">
<div class="card source-card">
<img src="{base_name}_source.png" alt="Prepared Source" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Original (Prepared)</div>
<div class="card-desc">Source image resized to 800x480 with LANCZOS resampling</div>
</div>
</div>
"""
for algo_name, (out_path, duration) in results.items():
algo_info = DITHER_ALGORITHMS[algo_name]
filename = Path(out_path).name
html += f"""
<div class="card">
<img src="{filename}" alt="{algo_info['name']}" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">{algo_info['name']}</div>
<div class="card-desc">{algo_info['description']}</div>
<div class="card-time">Processing time: {duration:.2f}s</div>
</div>
</div>
"""
html += """
</div>
<div class="fullscreen" onclick="hideFullscreen()">
<img src="" id="fullscreen-img">
</div>
<script>
function showFullscreen(img) {
document.getElementById('fullscreen-img').src = img.src;
document.querySelector('.fullscreen').classList.add('active');
}
function hideFullscreen() {
document.querySelector('.fullscreen').classList.remove('active');
}
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape') hideFullscreen();
});
</script>
</body>
</html>
"""
html_file = output_path / f"{base_name}_report.html"
html_file.write_text(html.replace('{base_name}', base_name))
print(f"HTML report saved: {html_file}")
return str(html_file)
def list_algorithms():
"""Print available algorithms with descriptions."""
print("\nAvailable Dithering Algorithms:")
print("=" * 70)
for name, info in DITHER_ALGORITHMS.items():
print(f"\n {name}")
print(f" Name: {info['name']}")
print(f" {info['description']}")
print()
def main():
parser = argparse.ArgumentParser(
description='Compare dithering algorithms for 6-color e-ink display',
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
python compare.py photo.jpg # Compare all algorithms
python compare.py photo.jpg -a atkinson pil_fs # Compare specific algorithms
python compare.py photo.jpg --grid # Generate grid comparison
python compare.py photo.jpg --html # Generate HTML report
python compare.py photo.jpg --side-by-side atkinson floyd_steinberg
python compare.py --list # List available algorithms
"""
)
parser.add_argument('image', nargs='?', help='Input image file')
parser.add_argument('-a', '--algorithms', nargs='+',
help='Specific algorithms to compare (default: all)')
parser.add_argument('-o', '--output', default='dither_output',
help='Output directory (default: dither_output)')
parser.add_argument('--orientation', '-r', type=int, default=0,
choices=[0, 90, 180, 270],
help='Rotate image (degrees)')
parser.add_argument('--grid', action='store_true',
help='Generate grid comparison image')
parser.add_argument('--html', action='store_true',
help='Generate HTML comparison report')
parser.add_argument('--side-by-side', nargs=2, metavar=('ALGO1', 'ALGO2'),
help='Create side-by-side comparison of two algorithms')
parser.add_argument('--list', action='store_true',
help='List available algorithms')
args = parser.parse_args()
if args.list:
list_algorithms()
return
if not args.image:
parser.error("Image file is required (unless using --list)")
if not os.path.exists(args.image):
print(f"Error: File not found: {args.image}")
sys.exit(1)
print(f"\n{'='*60}")
print(f"Dithering Comparison Test Suite")
print(f"{'='*60}\n")
if args.side_by_side:
create_side_by_side(
args.image,
args.side_by_side[0],
args.side_by_side[1],
args.output,
args.orientation
)
elif args.grid:
create_comparison_grid(
args.image,
args.algorithms,
args.output,
args.orientation
)
else:
results = run_comparison(
args.image,
args.algorithms,
args.output,
args.orientation
)
if args.html:
generate_html_report(args.image, results, args.output)
print(f"\n{'='*60}")
print(f"Done! Output saved to: {args.output}/")
print(f"{'='*60}\n")
if __name__ == '__main__':
main()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

View file

@ -1,269 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Dithering Comparison: _DSC2637-sterling</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #1a1a2e;
color: #eee;
margin: 0;
padding: 20px;
}
h1 { color: #00d9ff; margin-bottom: 10px; }
.subtitle { color: #888; margin-bottom: 30px; }
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
gap: 20px;
}
.card {
background: #16213e;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.card img {
width: 100%;
height: auto;
display: block;
cursor: pointer;
transition: transform 0.2s;
}
.card img:hover { transform: scale(1.02); }
.card-info {
padding: 15px;
}
.card-title {
font-size: 18px;
font-weight: 600;
color: #00d9ff;
margin-bottom: 5px;
}
.card-desc {
font-size: 13px;
color: #888;
margin-bottom: 8px;
}
.card-time {
font-size: 12px;
color: #666;
}
.source-card {
grid-column: 1 / -1;
max-width: 850px;
}
.source-card img { max-width: 800px; }
.palette {
display: flex;
gap: 10px;
margin: 20px 0;
padding: 15px;
background: #16213e;
border-radius: 8px;
width: fit-content;
}
.color-swatch {
width: 40px;
height: 40px;
border-radius: 6px;
border: 2px solid #333;
}
.fullscreen {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.95);
z-index: 1000;
justify-content: center;
align-items: center;
}
.fullscreen img {
max-width: 95%;
max-height: 95%;
}
.fullscreen.active { display: flex; }
</style>
</head>
<body>
<h1>Dithering Algorithm Comparison</h1>
<p class="subtitle">Source: /volumes/syncthing/Projects/frame/src/_DSC2637-sterling.jpg</p>
<h3>6-Color Palette</h3>
<div class="palette">
<div class="color-swatch" style="background: rgb(0,0,0);" title="Black"></div>
<div class="color-swatch" style="background: rgb(255,255,255);" title="White"></div>
<div class="color-swatch" style="background: rgb(255,255,0);" title="Yellow"></div>
<div class="color-swatch" style="background: rgb(255,0,0);" title="Red"></div>
<div class="color-swatch" style="background: rgb(0,0,255);" title="Blue"></div>
<div class="color-swatch" style="background: rgb(0,255,0);" title="Green"></div>
</div>
<h3>Results</h3>
<div class="grid">
<div class="card source-card">
<img src="_DSC2637-sterling_source.png" alt="Prepared Source" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Original (Prepared)</div>
<div class="card-desc">Source image resized to 800x480 with LANCZOS resampling</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_none.png" alt="No Dithering (PIL)" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">No Dithering (PIL)</div>
<div class="card-desc">Simple nearest-color quantization without error diffusion</div>
<div class="card-time">Processing time: 0.00s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_pil_fs.png" alt="Floyd-Steinberg (PIL)" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Floyd-Steinberg (PIL)</div>
<div class="card-desc">PIL built-in Floyd-Steinberg implementation</div>
<div class="card-time">Processing time: 0.01s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_floyd_steinberg.png" alt="Floyd-Steinberg" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Floyd-Steinberg</div>
<div class="card-desc">Classic error diffusion (1976), good balance of speed and quality</div>
<div class="card-time">Processing time: 3.58s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_floyd_steinberg_weighted.png" alt="Floyd-Steinberg (Weighted)" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Floyd-Steinberg (Weighted)</div>
<div class="card-desc">Floyd-Steinberg with perceptual color weighting</div>
<div class="card-time">Processing time: 3.93s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_atkinson.png" alt="Atkinson" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Atkinson</div>
<div class="card-desc">Bill Atkinson (Apple), diffuses only 75% of error for cleaner results</div>
<div class="card-time">Processing time: 3.57s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_atkinson_weighted.png" alt="Atkinson (Weighted)" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Atkinson (Weighted)</div>
<div class="card-desc">Atkinson with perceptual color weighting</div>
<div class="card-time">Processing time: 3.89s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_jarvis.png" alt="Jarvis-Judice-Ninke" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Jarvis-Judice-Ninke</div>
<div class="card-desc">Larger diffusion kernel (1976), smoother gradients but slower</div>
<div class="card-time">Processing time: 7.85s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_stucki.png" alt="Stucki" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Stucki</div>
<div class="card-desc">Similar to JJN with modified weights (1981)</div>
<div class="card-time">Processing time: 7.83s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_sierra.png" alt="Sierra" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Sierra</div>
<div class="card-desc">Full Sierra dithering, balanced results</div>
<div class="card-time">Processing time: 6.75s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_sierra_lite.png" alt="Sierra Lite" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Sierra Lite</div>
<div class="card-desc">Faster Sierra variant with smaller kernel</div>
<div class="card-time">Processing time: 3.03s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_burkes.png" alt="Burkes" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Burkes</div>
<div class="card-desc">Simplified two-row error diffusion</div>
<div class="card-time">Processing time: 5.21s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_bayer2.png" alt="Ordered (Bayer 2x2)" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Ordered (Bayer 2x2)</div>
<div class="card-desc">Ordered dithering with 2x2 Bayer matrix</div>
<div class="card-time">Processing time: 2.05s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_bayer4.png" alt="Ordered (Bayer 4x4)" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Ordered (Bayer 4x4)</div>
<div class="card-desc">Ordered dithering with 4x4 Bayer matrix</div>
<div class="card-time">Processing time: 2.05s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_bayer8.png" alt="Ordered (Bayer 8x8)" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Ordered (Bayer 8x8)</div>
<div class="card-desc">Ordered dithering with 8x8 Bayer matrix</div>
<div class="card-time">Processing time: 2.04s</div>
</div>
</div>
<div class="card">
<img src="_DSC2637-sterling_bayer4_strong.png" alt="Ordered (Bayer 4x4 Strong)" onclick="showFullscreen(this)">
<div class="card-info">
<div class="card-title">Ordered (Bayer 4x4 Strong)</div>
<div class="card-desc">Bayer 4x4 with increased dithering strength</div>
<div class="card-time">Processing time: 2.03s</div>
</div>
</div>
</div>
<div class="fullscreen" onclick="hideFullscreen()">
<img src="" id="fullscreen-img">
</div>
<script>
function showFullscreen(img) {
document.getElementById('fullscreen-img').src = img.src;
document.querySelector('.fullscreen').classList.add('active');
}
function hideFullscreen() {
document.querySelector('.fullscreen').classList.remove('active');
}
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape') hideFullscreen();
});
</script>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 KiB

Some files were not shown because too many files have changed in this diff Show more