Skip to content

Inscoper::Image

Image class represents an image with associated metadata. More...

#include <Image.h>

Public Functions

Name
Image(const std::vector< unsigned char > & imageData, const std::map< std::string, Inscoper::Metadata > & metadata)
Constructor.
unsigned int getPixelSize()
Get the pixel size.
unsigned int getBitDepth()
Get the image bit depth.
unsigned int getWidth() const
Get the image width.
unsigned int getHeight() const
Get the image height.
Inscoper::EPixelType getPixelType()
Get the pixel type.
void * getImageData()
Get the image data.
bool hasMetadata(const std::string & name)
Check if a metadata exists.
void addMetadata(const std::string & name, const Inscoper::Metadata & value)
Add or update a metadata.
void removeMetadata(const std::string & name)
Remove a metadata.
const std::map< std::string, Inscoper::Metadata > & getMetadata() const
Get all metadata.
Inscoper::Metadata getMetadata(const std::string & key) const
Get a metadata.
void setMetadata(const std::map< std::string, Inscoper::Metadata > & metadata)
Set all metadata.

Detailed Description

class Inscoper::Image;

Image class represents an image with associated metadata.

This class encapsulates raw image data associated with metadata, providing methods to access pixel properties, dimensions, and metadata.

Public Functions Documentation

function Image

Image(
    const std::vector< unsigned char > & imageData,
    const std::map< std::string, Inscoper::Metadata > & metadata
)

Constructor.

Parameters:

  • imageData : The raw bytes of the image
  • metadata : A map pairing metadata keys with values

Initializes a new instance of the Image class with raw data and metadata.

function getPixelSize

unsigned int getPixelSize()

Get the pixel size.

Return: The pixel size in bytes

Retrieves the size of a single pixel in bytes.

function getBitDepth

unsigned int getBitDepth()

Get the image bit depth.

Return: The bit depth of the image

Retrieves the bit depth of the image (e.g., 8, 16 bits).

function getWidth

unsigned int getWidth() const

Get the image width.

Return: The width of the image in pixels

Retrieves the width of the image in pixels.

function getHeight

unsigned int getHeight() const

Get the image height.

Return: The height of the image in pixels

Retrieves the height of the image in pixels.

function getPixelType

Inscoper::EPixelType getPixelType()

Get the pixel type.

Return: The pixel type

Retrieves the format of the pixels (bit depth and gray/rgb).

function getImageData

void * getImageData()

Get the image data.

Return: The image data

Retrieves the raw image data.

function hasMetadata

bool hasMetadata(
    const std::string & name
)

Check if a metadata exists.

Parameters:

  • name : The name of the metadata to check

Return: True if the metadata exists, false otherwise

Determines if a specific metadata exists in the image.

function addMetadata

void addMetadata(
    const std::string & name,
    const Inscoper::Metadata & value
)

Add or update a metadata.

Parameters:

  • name : The name of the metadata
  • value : The metadata value to store

Inserts a new metadata or updates an existing one.

function removeMetadata

void removeMetadata(
    const std::string & name
)

Remove a metadata.

Parameters:

  • name : The name of the metadata to remove

Exceptions:

Deletes a metadata.

function getMetadata

const std::map< std::string, Inscoper::Metadata > & getMetadata() const

Get all metadata.

Return: The map pairing metadata keys with values

Retrieves all metadata associated with the image.

function getMetadata

Inscoper::Metadata getMetadata(
    const std::string & key
) const

Get a metadata.

Parameters:

  • key : The name of the metadata

Exceptions:

Return: The metadata value

Retrieves a metadata.

function setMetadata

void setMetadata(
    const std::map< std::string, Inscoper::Metadata > & metadata
)

Set all metadata.

Parameters:

  • metadata : The new map pairing metadata keys with values

Replaces all current metadata.


Updated on 2026-04-02 at 10:55:36 +0200