Histogram Generator
Generate detailed RGB histograms to analyze the tonal distribution of your images.
Upload Image
Results
Upload an image to see preview
Mean
128
Median
127
Standard Dev.
42.5
About Histogram Generator
The Histogram Generator provides detailed analysis of your image's tonal distribution across color channels. It's an essential tool for photographers and image editors to understand exposure, contrast, and color balance.
How It Works
When you upload an image, the tool:
- Analyzes each pixel's color values (Red, Green, Blue, and Luminance)
- Counts how many pixels fall into each intensity level (bin)
- Calculates statistical measures (mean, median, standard deviation)
- Generates interactive visualizations of the distribution
- Provides insights into the image's exposure and color characteristics
Key Features
- Channel Analysis: View histograms for individual RGB channels or combined luminance
- Customizable Bins: Adjust the granularity of the histogram (64 to 256 bins)
- Statistical Data: Get precise measurements of tonal distribution
- Interactive Charts: Hover to see exact values at each intensity level
- Image Preview: See your uploaded image alongside its histogram
Interpreting Histograms
Understanding histograms helps you evaluate your images:
- Shadows: Left side shows dark tones
- Midtones: Center shows medium tones
- Highlights: Right side shows bright tones
- Peaks: Indicate common tonal values
- Gaps: Show missing tonal values
- Clipping: Spikes at either end indicate lost detail
Technical Details
The histogram is generated by counting pixel values in each channel:
For each channel (R, G, B):
// Initialize bins
const bins = new Array(binCount).fill(0);
// Count pixel values
for (let i = 0; i < pixels.length; i += 4) {
const value = pixels[i]; // R, G, or B channel
const bin = Math.floor(value / (256 / binCount));
bins[bin]++;
}
Luminance calculation:
// Using the Rec. 709 luminance formula
const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
Statistics:
// Mean calculation
const mean = sum(values) / count;
// Median calculation
const sorted = [...values].sort((a, b) => a - b);
const median = sorted[Math.floor(sorted.length / 2)];
// Standard deviation
const squaredDiffs = values.map(v => Math.pow(v - mean, 2));
const variance = sum(squaredDiffs) / count;
const stdDev = Math.sqrt(variance);
The tool processes images entirely in your browser - no data is uploaded to servers.