Data and metadata for an image.
More...
#include <common.h>
Data and metadata for an image.
Definition at line 57 of file common.h.
◆ BPP
◆ BPC
◆ BitsPerPixel
Number of bits comprising a single image pixel.
Enumerator |
---|
Eight | |
Sixteen | |
TwentyFour | |
FortyEight | |
Definition at line 60 of file common.h.
◆ BitsPerChannel
Number of bits comprising a single color channel of a single pixel.
Definition at line 73 of file common.h.
◆ Colorspace
Enumerator |
---|
Grayscale | Single channel (shades of gray)
|
RGB | Three channels, with equal bit widths representing red, green, and blue, in order.
|
Definition at line 80 of file common.h.
◆ Image() [1/2]
◆ Image() [2/2]
FRIF::Image::Image |
( |
const uint8_t | identifier, |
|
|
const uint16_t | width, |
|
|
const uint16_t | height, |
|
|
const uint16_t | ppi, |
|
|
const Colorspace | colorspace, |
|
|
const BitsPerChannel | bpc, |
|
|
const BitsPerPixel | bpp, |
|
|
const std::vector< std::byte > & | pixels ) |
Image constructor.
- Parameters
-
identifier | An identifier for this image. Used to link Image to TemplateData and Correspondence. |
width | Width of the image in pixels. |
height | Height of the image in pixels. |
ppi | Resolution of the image in pixels per inch. |
colorspace | Representation of color in each byte within pixels . |
bpc | Number of bits used by each color component. |
bpp | Number of bits comprising a single pixel. |
pixels | width * height * (bpp / bpc ) bytes of image data, with pixels.front() representing the first byte of the top-left pixel, and pixels.back() representing the last byte of the bottom-right pixel. It is decompressed big endian image data, canonically coded as defined in ISO/IEC 19794-4:2005, section 6.2. For example, the value 0xFF00 when bpc is BPC::Sixteen, bpp is BPP::Sixteen and colorspace is Colorspace::Grayscale is significantly closer to white than it is to black. |
- Note
- You may call sanityCheck on this object to have some confidence that the image properties make sense.
Definition at line 52 of file libfrif_common.cpp.
◆ sanityCheck()
void FRIF::Image::sanityCheck |
( |
| ) |
const |
Validate that the properties of this Image appear to correspond to valid image data.
- Exceptions
-
std::logic_error | Some combination of properties appears invalid. |
Definition at line 74 of file libfrif_common.cpp.
◆ identifier
uint8_t FRIF::Image::identifier {} |
◆ width
uint16_t FRIF::Image::width {} |
Width of the image.
Definition at line 155 of file common.h.
◆ height
uint16_t FRIF::Image::height {} |
Height of the image.
Definition at line 157 of file common.h.
◆ ppi
uint16_t FRIF::Image::ppi {} |
Resolution of the image in pixels per inch.
Definition at line 159 of file common.h.
◆ colorspace
Representation of color in each byte within pixels
.
Definition at line 161 of file common.h.
◆ bpc
Number of bits used by each color component.
Definition at line 163 of file common.h.
◆ bpp
Number of bits comprising a single pixel.
Definition at line 165 of file common.h.
◆ pixels
std::vector<std::byte> FRIF::Image::pixels {} |
Raw pixel data of image.
width * height * (bpp / bpc) bytes of image data, with pixels .front()
representing the first byte of the top-left pixel, and pixels .back()
representing the last byte of the bottom-right pixel. It is decompressed big endian image data, canonically coded as defined in ISO/IEC 19794-4:2005, section 6.2. For example, the value 0xFF00
when bpc is BPC::Sixteen, bpp is BPP::Sixteen and colorspace is Colorspace::Grayscale is significantly closer to white than it is to black.
- Note
- To pass pixels to a C-style array, invoke pixel's
data()
method (pixels.data()
). You may safely reinterpret_cast
this value to std::vector<uint8_t>
if needed (e.g., to obtain a uint8_t*
from data()
).
Definition at line 187 of file common.h.
The documentation for this struct was generated from the following files: