🛠️ToolsShed

Luminance Converter

Convert between luminance units including cd/m², nit, foot-lambert, and stilb.

UnitLuminanceConverter.perCdm2
Candela/m² (cd/m²) — nit1.0000e+0
Nit (nt)1.0000e+0
Foot-lambert (fL)3.4263e+0
Stilb (sb)1.0000e+4
Apostilb (asb)3.1831e-1
Lambert (L)3.1831e+3
Millilambert (mL)3.1831e+0
Skot (sk)3.1831e-4
Hefnerkerze/m² (Hk/m²)9.0300e-1

Questions Fréquentes

Implémentation du Code

# Luminance unit conversions (base unit: cd/m²)
LUMINANCE_TO_CD_M2 = {
    "cd/m2": 1,
    "nit":   1,            # 1 nit = 1 cd/m²
    "fL":    3.42625,      # foot-lambert
    "sb":    10000,        # stilb
    "asb":   1 / 3.14159, # apostilb
    "L":     10000 / 3.14159,  # lambert
    "mL":    10 / 3.14159,     # millilambert
    "skot":  1e-3 / 3.14159,   # skot
}

def convert_luminance(value: float, from_unit: str, to_unit: str) -> float:
    cd_m2 = value * LUMINANCE_TO_CD_M2[from_unit]
    return cd_m2 / LUMINANCE_TO_CD_M2[to_unit]

# Examples
print(f"1 fL = {convert_luminance(1, 'fL', 'cd/m2'):.4f} cd/m²")
print(f"1 sb = {convert_luminance(1, 'sb', 'cd/m2'):.0f} cd/m²")
print(f"300 nit = {convert_luminance(300, 'nit', 'fL'):.2f} fL")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.