[!NOTE] This is one of 210 standalone projects, maintained as part of the @thi.ng/umbrella monorepo and anti-framework.
🚀 Please help me to work full-time on these projects by sponsoring me on GitHub. Thank you! ❤️
Image color & feature analysis utilities. This is a support package for @thi.ng/pixel.
- Dominant colors in different color modes/formats:
- CSS (hex)
- sRGB
- HSV
- Oklch (perceptual)
- Normalized areas of dominant color clusters
- Min/max HSV hue range of dominant colors (considering angular wrap-around)
- Min/max HSV saturation range of dominant colors
- Min/max luminance range of dominant colors (obtained from SRGB)
- Min/max luminance range of entire grayscale image (obtained from SRGB)
- Average values for hue (circular mean), saturation, luminance
- Area-weighted average saturation of dominant colors
- Area-weighted average luminance of dominant colors
- Standard deviation for hue, saturation, luminance
- Normalized color temperature, incl. area-weighted indicator of "cold" vs "warm" hues present
- Luminance contrast of dominant colors
- Luminance contrast of entire grayscale image
- Max. normalized WCAG color contrast of dominant colors
BETA - possibly breaking changes forthcoming
Search or submit any issues for this package
yarn add @thi.ng/pixel-analysis
ESM import:
import * as pa from "@thi.ng/pixel-analysis";
Browser ESM import:
<script type="module" src="https://esm.run/@thi.ng/pixel-analysis"></script>
For Node.js REPL:
const pa = await import("@thi.ng/pixel-analysis");
Package sizes (brotli'd, pre-treeshake): ESM: 1.87 KB
- @thi.ng/api
- @thi.ng/arrays
- @thi.ng/color
- @thi.ng/compare
- @thi.ng/math
- @thi.ng/metrics
- @thi.ng/pixel
- @thi.ng/pixel-convolve
- @thi.ng/pixel-dominant-colors
- @thi.ng/transducers
- @thi.ng/vectors
Note: @thi.ng/api is in most cases a type-only import (not used at runtime)
TODO
If this project contributes to an academic publication, please cite it as:
@misc{thing-pixel-analysis,
title = "@thi.ng/pixel-analysis",
author = "Karsten Schmidt",
note = "https://thi.ng/pixel-analysis",
year = 2024
}
© 2024 - 2025 Karsten Schmidt // Apache License 2.0