Color Spectrum PNG Creator
Generate and download high-resolution color spectrum PNG images. Create visible light, custom gradient, HSL, and rainbow spectrums with precise control.
About
Mapping wavelengths of electromagnetic radiation between 380nm and 780nm to sRGB triplets is a lossy operation. The CIE 1931 color matching functions define the perceptual response, but an sRGB monitor can only reproduce a subset of the visible gamut. This tool applies a simplified spectral-to-RGB algorithm with gamma correction (γ = 0.8) and intensity attenuation at the spectral edges, producing physically-grounded approximations rather than arbitrary rainbow gradients. For custom gradients, linear interpolation operates in RGB space per channel. HSL sweep mode rotates hue from 0° to 360° at constant saturation and lightness, which is useful for perceptual uniformity studies but does not represent physical light. Output dimensions up to 8192 × 8192px are supported. The PNG is generated natively in-browser with lossless compression.
Formulas
The visible light spectrum renderer converts wavelength λ to an RGB triplet using a piecewise linear approximation of the CIE response curves.
An intensity factor f attenuates the spectral edges to simulate the eye's reduced sensitivity:
Final pixel value: Rout = round(255 × (R ⋅ f)γ) where γ = 0.8. For custom gradients, linear interpolation per channel: C(t) = C1 ⋅ (1 − t) + C2 ⋅ t where t ∈ [0, 1].
Where λ = wavelength in nanometers, f = intensity attenuation factor, γ = gamma correction exponent, C1 and C2 = start and end color channel values, t = normalized position along the gradient axis.
Reference Data
| Color | Wavelength Range | Frequency Range | Approx. sRGB Hex | Photon Energy |
|---|---|---|---|---|
| Violet | 380 - 450 nm | 668 - 789 THz | #7F00FF | 2.76 - 3.26 eV |
| Blue | 450 - 485 nm | 618 - 668 THz | #0000FF | 2.56 - 2.76 eV |
| Cyan | 485 - 500 nm | 600 - 618 THz | #00FFFF | 2.48 - 2.56 eV |
| Green | 500 - 565 nm | 530 - 600 THz | #00FF00 | 2.19 - 2.48 eV |
| Yellow | 565 - 590 nm | 508 - 530 THz | #FFFF00 | 2.10 - 2.19 eV |
| Orange | 590 - 625 nm | 480 - 508 THz | #FF8000 | 1.98 - 2.10 eV |
| Red | 625 - 780 nm | 384 - 480 THz | #FF0000 | 1.59 - 1.98 eV |
| Near IR (edge) | 750 - 780 nm | 384 - 400 THz | Attenuated dark red | 1.59 - 1.65 eV |
| Near UV (edge) | 380 - 400 nm | 749 - 789 THz | Attenuated violet | 3.10 - 3.26 eV |
| Common Gradient Interpolation Spaces | ||||
| sRGB Linear | Channel-wise lerp in gamma-corrected sRGB | Fast, simple | Can produce dark midpoints | |
| Linear RGB | Lerp in linearized (gamma-decoded) space | Physically accurate | Perceptually non-uniform | |
| HSL | Hue/Saturation/Lightness interpolation | Perceptual hue rotation | Gray midpoints possible | |
| HSV | Hue/Saturation/Value interpolation | Similar to HSL | Slightly different lightness curve | |
| OKLAB | Perceptually uniform color space (2020) | Best perceptual results | Complex conversion math | |
| PNG Format Details | ||||
| Bit Depth | 8 bits per channel (RGBA) | 32 bpp | Lossless compression | |
| Max Dimension | Browser-dependent, typically 8192 - 16384 px | Canvas limit | Memory dependent | |
| Color Profile | sRGB (IEC 61966-2-1) | Standard web | Gamma 2.2 | |