Skip to content

ryumacodes/azusa

Repository files navigation

azusa

Auto white balance correction for digital images using professional color science.

Features

  • Bradford Chromatic Adaptation: Professional-grade white balance using perceptually accurate transform
  • Ensemble Illuminant Detection: Combines Gray World, Shades of Gray, and White Patch algorithms
  • Smart Adaptive Correction: Per-pixel weighting based on luminance, saturation, and warmth
  • Neutral Guards: Prevents overcorrection with automatic feedback loops
  • Skin Tone Preservation: Intelligent protection of natural skin colors
  • Real-time Processing: Instant preview with adjustable parameters
  • Download Support: Save corrected images as high-quality JPEG
  • Dark/Light Theme: Clean interface with system preference detection
  • Client-side Processing: No uploads required - everything runs in your browser

Usage

  1. Upload Image: Drag and drop or select an image file (JPEG/PNG/WebP)
  2. Automatic Analysis: App detects color temperature and warmth levels (0-100 scale)
  3. Adjust Parameters:
    • Strength: Correction intensity (0-100%)
    • Preserve Skin: Protects skin tones from over-correction
    • Auto-Correct: Enables tone curve and contrast enhancement
    • Keep Whites Neutral: Prevents neutral colors from shifting
    • Neutral Bias: Fine-tune the neutral point
    • Vivid: Restores color saturation (0-100%)
  4. Compare Results: Interactive before/after slider
  5. Download: Click button to save corrected image

How It Works

Bradford Transform

The app uses the Bradford chromatic adaptation transform, which models human visual adaptation:

  1. Illuminant Estimation: Weighted ensemble of detection methods
  2. Color Space Transform: RGB → XYZ → LMS cone space
  3. Diagonal Scaling: Adapt between source and target illuminants
  4. Perceptual Application: Per-pixel weighting based on image characteristics

Detection Methods

  • Gray World: Assumes average scene color should be neutral
  • Shades of Gray: Higher-order statistics with Minkowski norm (p=6)
  • White Patch: Brightest pixels as reference whites
  • Dynamic Weighting: More reliance on White Patch for stronger casts

Adaptive Processing

  • Luminance Weighting: More correction in mid-tones, less in highlights
  • Saturation Boost: Restores colors lost during white balance
  • Warmth Targeting: Focuses correction on warm/yellow areas
  • Neutral Protection: Iterative feedback to prevent blue shifts

Development

# Install dependencies
pnpm install

# Start development server
pnpm run dev

# Build for production
pnpm run build

# Preview production build
pnpm run preview

Deployment

This app is configured for GitHub Pages deployment. Push to the main branch to automatically deploy via GitHub Actions.

Technical Details

  • Framework: Svelte 5 with TypeScript
  • Build Tool: Vite
  • Performance: 12-30ms analysis on 12MP images, 120-400ms full correction
  • Color Science: D65 illuminant, accurate sRGB ↔ CIELAB conversions
  • Browser Compatibility: Modern browsers with Canvas API support

License

This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License.

You are free to:

  • Share and redistribute the material
  • Adapt, remix, and build upon the material

Under the following terms:

  • Attribution — You must give appropriate credit
  • NonCommercial — You may not use the material for commercial purposes

See the LICENSE file for full details.

About

Auto white balance correction using Bradford chromatic adaptation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors