Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
image_preprocessor.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
18#pragma once
19
20#include <cstddef>
21#include <cstdint>
22#include <filesystem>
23#include <string>
24#include <vector>
25
26namespace entropic {
27
33 int max_width = 1280;
34 int max_height = 1280;
35 size_t max_file_size = 20 * 1024 * 1024;
36 bool preserve_aspect = true;
37};
38
44 std::vector<uint8_t> pixel_data;
45 int width = 0;
46 int height = 0;
47 int channels = 3;
48 std::string source_path;
49};
50
60public:
66 explicit ImagePreprocessor(const ImagePreprocessConfig& config);
67
75 PreprocessedImage preprocess_file(const std::filesystem::path& path);
76
87 const uint8_t* data,
88 size_t len,
89 const std::string& source_label);
90
91private:
92 ImagePreprocessConfig config_;
93
102 PreprocessedImage decode(
103 const uint8_t* data, size_t len,
104 const std::string& source);
105
111 void resize_if_needed(PreprocessedImage& img);
112};
113
114} // namespace entropic
Image preprocessor — validates, resizes, and normalizes images.
PreprocessedImage preprocess_file(const std::filesystem::path &path)
Preprocess an image from file path.
PreprocessedImage preprocess_buffer(const uint8_t *data, size_t len, const std::string &source_label)
Preprocess an image from memory buffer.
Activate model on GPU (WARM → ACTIVE).
Image preprocessing configuration.
bool preserve_aspect
Preserve aspect ratio when resizing.
int max_width
Maximum image width (resized if exceeded)
int max_height
Maximum image height (resized if exceeded)
size_t max_file_size
Maximum file size in bytes (20MB)
Preprocessed image ready for vision encoder.
std::string source_path
Original source path (for logging)
int height
Image height in pixels.
std::vector< uint8_t > pixel_data
RGB pixel data (row-major)
int width
Image width in pixels.
int channels
Color channels (always 3 = RGB)