Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::archetypes::EncodedImage Struct Reference

Archetype: An image encoded as e.g. More...

#include <rerun/archetypes/encoded_image.hpp>

Public Types

using IndicatorComponent = rerun::components::IndicatorComponent< IndicatorComponentName >
 Indicator component, used to identify the archetype when converting to a list of components.
 

Public Member Functions

 EncodedImage (EncodedImage &&other)=default
 
EncodedImage with_media_type (rerun::components::MediaType _media_type) &&
 The Media Type of the asset.
 
EncodedImage with_opacity (rerun::components::Opacity _opacity) &&
 Opacity of the image, useful for layering several images.
 
EncodedImage with_draw_order (rerun::components::DrawOrder _draw_order) &&
 An optional floating point value that specifies the 2D drawing order.
 

Static Public Member Functions

static Result< EncodedImagefrom_file (const std::filesystem::path &filepath)
 Create a new EncodedImage from the contents of a file on disk, e.g. a PNG or JPEG.
 
static EncodedImage from_bytes (rerun::Collection< uint8_t > image_contents, std::optional< rerun::components::MediaType > media_type={})
 Create a new EncodedImage from the contents of an image file, like a PNG or JPEG.
 

Public Attributes

rerun::components::Blob blob
 The encoded content of some image file, e.g. a PNG or JPEG.
 
std::optional< rerun::components::MediaTypemedia_type
 The Media Type of the asset.
 
std::optional< rerun::components::Opacityopacity
 Opacity of the image, useful for layering several images.
 
std::optional< rerun::components::DrawOrderdraw_order
 An optional floating point value that specifies the 2D drawing order.
 

Static Public Attributes

static constexpr const char IndicatorComponentName []
 

Detailed Description

Archetype: An image encoded as e.g.

a JPEG or PNG.

Rerun also supports uncompressed images with the archetypes::Image. For images that refer to video frames see archetypes::VideoFrameReference.

Example

encoded_image:

#include <rerun.hpp>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <vector>
namespace fs = std::filesystem;
int main() {
const auto rec = rerun::RecordingStream("rerun_example_encoded_image");
rec.spawn().exit_on_failure();
fs::path image_filepath = fs::path(__FILE__).parent_path() / "ferris.png";
rec.log("image", rerun::EncodedImage::from_file(image_filepath).value_or_throw());
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:60

Member Function Documentation

◆ from_bytes()

static EncodedImage rerun::archetypes::EncodedImage::from_bytes ( rerun::Collection< uint8_t >  image_contents,
std::optional< rerun::components::MediaType media_type = {} 
)
inlinestatic

Create a new EncodedImage from the contents of an image file, like a PNG or JPEG.

If no MediaType is specified, the Rerun Viewer will try to guess one from the data at render-time. If it can't, rendering will fail with an error.

◆ with_media_type()

EncodedImage rerun::archetypes::EncodedImage::with_media_type ( rerun::components::MediaType  _media_type) &&
inline

The Media Type of the asset.

Supported values:

  • image/jpeg
  • image/png

If omitted, the viewer will try to guess from the data blob. If it cannot guess, it won't be able to render the asset.

◆ with_opacity()

EncodedImage rerun::archetypes::EncodedImage::with_opacity ( rerun::components::Opacity  _opacity) &&
inline

Opacity of the image, useful for layering several images.

Defaults to 1.0 (fully opaque).

◆ with_draw_order()

EncodedImage rerun::archetypes::EncodedImage::with_draw_order ( rerun::components::DrawOrder  _draw_order) &&
inline

An optional floating point value that specifies the 2D drawing order.

Objects with higher values are drawn on top of those with lower values.

Member Data Documentation

◆ media_type

std::optional<rerun::components::MediaType> rerun::archetypes::EncodedImage::media_type

The Media Type of the asset.

Supported values:

  • image/jpeg
  • image/png

If omitted, the viewer will try to guess from the data blob. If it cannot guess, it won't be able to render the asset.

◆ opacity

std::optional<rerun::components::Opacity> rerun::archetypes::EncodedImage::opacity

Opacity of the image, useful for layering several images.

Defaults to 1.0 (fully opaque).

◆ draw_order

std::optional<rerun::components::DrawOrder> rerun::archetypes::EncodedImage::draw_order

An optional floating point value that specifies the 2D drawing order.

Objects with higher values are drawn on top of those with lower values.

◆ IndicatorComponentName

constexpr const char rerun::archetypes::EncodedImage::IndicatorComponentName[]
staticconstexpr
Initial value:
=
"rerun.components.EncodedImageIndicator"

The documentation for this struct was generated from the following file: