Structure representing an extracted image from a document.
Matches the Rust ExtractedImage struct.
Fields
:data- Raw binary image data (PNG, JPEG, WebP, etc.):format- Image format string ("png", "jpeg", "webp", etc.):image_index- Zero-indexed position of image in the document/page:page_number- Page number where image was found:width- Image width in pixels:height- Image height in pixels:colorspace- Color space (e.g., "RGB", "CMYK", "Gray"):bits_per_component- Bits per color component (e.g., 8, 16):is_mask- Whether this image is a mask image:description- Optional description of the image:ocr_result- Nested OCR extraction result map:bounding_box- Bounding box coordinates if available
Summary
Functions
Creates an Image struct from a map.
Returns whether the image has binary data.
Creates a new Image struct.
Converts an Image struct to a map.
Types
@type t() :: %Kreuzberg.Image{ bits_per_component: non_neg_integer() | nil, bounding_box: map() | nil, colorspace: String.t() | nil, data: binary(), description: String.t() | nil, format: String.t(), height: non_neg_integer() | nil, image_index: non_neg_integer(), is_mask: boolean(), ocr_result: Kreuzberg.ExtractionResult.t() | nil, page_number: non_neg_integer() | nil, width: non_neg_integer() | nil }
Functions
Creates an Image struct from a map.
Handles bytes::Bytes serde serialization where binary data arrives
as a list of u8 integers, converting it to Elixir binary.
Examples
iex> Kreuzberg.Image.from_map(%{"format" => "png", "image_index" => 0, "width" => 800})
%Kreuzberg.Image{format: "png", image_index: 0, width: 800}
Returns whether the image has binary data.
Creates a new Image struct.
Parameters
format- The image format (e.g., "png", "jpeg")opts- Optional keyword list of additional fields
Converts an Image struct to a map.