include/entropic/inference/image_preprocessor.h

← API

include/entropic/inference/image_preprocessor.h

entropic::ImagePreprocessConfig

Image preprocessing configuration.

int entropic::ImagePreprocessConfig::max_width

Maximum image width (resized if exceeded)

int entropic::ImagePreprocessConfig::max_height

Maximum image height (resized if exceeded)

size_t entropic::ImagePreprocessConfig::max_file_size

Maximum file size in bytes (20MB)

bool entropic::ImagePreprocessConfig::preserve_aspect

Preserve aspect ratio when resizing.

entropic::ImagePreprocessor

Image preprocessor — validates, resizes, and normalizes images.

entropic::ImagePreprocessor::ImagePreprocessor(const ImagePreprocessConfig &config)

Construct preprocessor with config.

Parameters
  • config — Preprocessing configuration.

PreprocessedImage entropic::ImagePreprocessor::preprocess_file(const std::filesystem::path &path)

Preprocess an image from file path.

Parameters
  • path — File path to image.
Returns
  • Preprocessed image ready for vision encoder.
  • Preprocessed image ready for the vision encoder: RGB pixel data, within the configured dimension bounds. A missing file, an oversize file, or a non-image is rejected by throwing rather than passed downstream.
Throws
  • std::runtime_error — on invalid format, oversized file, or read error.

PreprocessedImage entropic::ImagePreprocessor::preprocess_buffer(const uint8_t *data, size_t len, const std::string &source_label)

Preprocess an image from memory buffer.

Parameters
  • data — Raw image data (JPEG, PNG, BMP, GIF).
  • len — Data length in bytes.
  • source_label — Label for logging (e.g., "data_uri").
Returns
  • Preprocessed image.
  • Preprocessed image: RGB pixel data within the configured dimension bounds; a non-image buffer is rejected by throwing.
Throws
  • std::runtime_error — on invalid format or decode error.

entropic::PreprocessedImage

Preprocessed image ready for vision encoder.

std::vector<uint8_t> entropic::PreprocessedImage::pixel_data

RGB pixel data (row-major)

int entropic::PreprocessedImage::width

Image width in pixels.

int entropic::PreprocessedImage::height

Image height in pixels.

int entropic::PreprocessedImage::channels

Color channels (always 3 = RGB)

std::string entropic::PreprocessedImage::source_path

Original source path (for logging)