class

PrismatIQ::Core::PaletteExtractor

Inherits PrismatIQ::Utils::HistogramProcessor < Reference < Object

Thread-safe palette extraction orchestrator.

This class handles the complete palette extraction workflow from raw pixel data to final dominant colors. It coordinates histogram building, quantization, and result processing while maintaining thread safety.

Thread Safety

  • Stateless Design: No shared mutable state between instances
  • Safe Concurrent Access: Multiple threads can use different instances simultaneously without coordination
  • Config Isolation: Each instance uses its own Config for processing

Memory Optimization

  • Configurable max image dimensions via Config
  • Sequential histogram building with bounded iteration

Usage

extractor = PrismatIQ::Core::PaletteExtractor.new
palette = extractor.extract_from_path("image.jpg", options)

Constructors

new(config : Config = Config.default)

Instance methods

extract_from_buffer(pixels : Slice(UInt8), width : Int32, height : Int32, options : Options) : Array(RGB)
extract_from_image(image, options : Options) : Array(RGB)
extract_from_image_data(rgba_image, width : Int32, height : Int32, options : Options) : Array(RGB)
extract_from_io(io : IO, options : Options) : Array(RGB)
extract_from_path(path : String, options : Options) : Array(RGB)