Perfectly Clear SDK Documentation
9.0.1.315
|
PFCImageFile Class to encapsulate file handling. More...
#include <PFCImageFile.h>
Public Types | |
enum | PFC_FILETYPE |
Type for compressing/decomrpessing a buffer. More... | |
Public Member Functions | |
PFCImageFile () | |
Constructs empty PFCImageFile, to be filled with LoadImageFile() More... | |
PFCImageFile (int width, int height, const PFCImageFile &model) | |
Constructs PFCImageFile with allocation for image of given size and format. More... | |
PFCImageFile (int width, int height, int bytes_per_pixel, int stride) | |
Constructs PFCImageFile with allocation for image of given size. More... | |
PFC_FILE_LOAD_STATUS | LoadImageFile (const char *filename, bool bConvertToSRGB, const char *iccFolderPath) |
Load JPEG, PNG or RAW from file on disk. More... | |
PFC_FILE_LOAD_STATUS | LoadImageFile (const char *filename, PFC_FILETYPE type, bool bConvertToSRGB, const char *iccFolderPath) |
Load JPEG, PNG or RAW from file on disk. More... | |
PFC_FILE_LOAD_STATUS | ExpandImageBuffer (char *data, long size, PFC_FILETYPE type, bool bConvertToSRGB, const char *iccFolderPath) |
Expands the image file data provided in a buffer. More... | |
int | CompressImageBuffer (unsigned char **destination, PFC_FILETYPE type, int quality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata) |
Compresses the image to the given type and writes compressed data to destination buffer. More... | |
bool | SaveImageFile (const char *filename, int quality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata) |
Write image data to file - specify file type with filename extension. More... | |
bool | SaveImageFile (const char *filename, PFC_FILETYPE type, int quality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata) |
Write image data to file - specify file type with PFC_FILETYPE. More... | |
Data Fields | |
unsigned char * | raw_image |
int | width |
int | height |
int | bytes_per_pixel |
int | stride |
bool | sourceSRGB |
PFCImageFile Class to encapsulate file handling.
This is an optional class you can use to read and write JPEG, PNG and WebP files, manage EXIF metadata and perform color space conversion (to / from sRGB). At this time, only RGB formatted images are supported. Basic usage:
Then, load PFCIMAGE with this data:
Correct the image:
Then write image back to disk:
Definition at line 59 of file PFCImageFile.h.
int CompressImageBuffer | ( | unsigned char ** | destination, |
PFC_FILETYPE | type, | ||
int | quality, | ||
bool | bConvertToOriginalColorSpace, | ||
bool | bEmbedOriginalMetadata | ||
) |
Compresses the image to the given type and writes compressed data to destination buffer.
destination | [out] - pointer to the compressed buffer. Create this buffer through malloc, and disposed through free(). |
type | [in] - filetype of the file to create. |
quality | [in] - Sets the output quality for the compression. Ignored for PNGs. We recomend 92. |
bConvertToOriginalColorSpace | [in] - Convert the file back to the input colorspace. If false, the resutling file will be in sRGB. |
bEmbedOriginalMetadata | [in] - Set to true to copy EXIF data from original to output. This can be critical for images with EXIF rotation flag. |
PFC_FILE_LOAD_STATUS ExpandImageBuffer | ( | char * | data, |
long | size, | ||
PFC_FILETYPE | type, | ||
bool | bConvertToSRGB, | ||
const char * | iccFolderPath | ||
) |
Expands the image file data provided in a buffer.
data | [in] - pointer to compressed image data in a buffer. Its contets are examined but PFCImageFile does not take ownership. |
size | [in] - size of the data buffer. |
type | [in] - filetype of the buffer contents. |
bConvertToSRGB | [in] - Bool to control conversion to sRGB, usually should be set to true. |
iccFolderPath | [in] - Some JPEGs may be in AdobeRGB without AdobeRGB being actually embedded. Path to folder containing AdobeRGB1998.icc should be passed here |
PFC_FILE_LOAD_STATUS LoadImageFile | ( | const char * | filename, |
bool | bConvertToSRGB, | ||
const char * | iccFolderPath | ||
) |
Load JPEG, PNG or RAW from file on disk.
filename | [in] - path to file to load |
bConvertToSRGB | [in] - Bool to control conversion to sRGB, usually should be set to true |
iccFolderPath | [in] - Some JPEGs may be in AdobeRGB without AdobeRGB being actually embedded. Path to folder containing AdobeRGB1998.icc should be passed here |
PFC_FILE_LOAD_STATUS LoadImageFile | ( | const char * | filename, |
PFC_FILETYPE | type, | ||
bool | bConvertToSRGB, | ||
const char * | iccFolderPath | ||
) |
Load JPEG, PNG or RAW from file on disk.
filename | [in] - path to file to load |
type | [in] - filetype of the file to create. |
bConvertToSRGB | [in] - Bool to control conversion to sRGB, usually should be set to true |
iccFolderPath | [in] - Some JPEGs may be in AdobeRGB without AdobeRGB being actually embedded. Path to folder containing AdobeRGB1998.icc should be passed here |
bool SaveImageFile | ( | const char * | filename, |
int | quality, | ||
bool | bConvertToOriginalColorSpace, | ||
bool | bEmbedOriginalMetadata | ||
) |
Write image data to file - specify file type with filename extension.
filename | [in] - filename to write to. The filename determines the type of file created, and must end in .jpg or .png |
quality | [in] - Sets the output quality for the compression. Ignored for PNGs. We recomend 92. |
bConvertToOriginalColorSpace | [in] - Convert the file back to the input colorspace. If false, the resutling file will be in sRGB. |
bEmbedOriginalMetadata | [in] - Set to true to copy EXIF data from original to output. This can be critical for images with EXIF rotation flag. |
bool SaveImageFile | ( | const char * | filename, |
PFC_FILETYPE | type, | ||
int | quality, | ||
bool | bConvertToOriginalColorSpace, | ||
bool | bEmbedOriginalMetadata | ||
) |
Write image data to file - specify file type with PFC_FILETYPE.
filename | [in] - filename to write to. |
type | [in] - filetype of the file to create. |
quality | [in] - Sets the output quality for the compression. Ignored for PNGs. We recomend 92. |
bConvertToOriginalColorSpace | [in] - Convert the file back to the input colorspace. If false, the resutling file will be in sRGB. |
bEmbedOriginalMetadata | [in] - Set to true to copy EXIF data from original to output. This can be critical for images with EXIF rotation flag. |
enum PFC_FILETYPE |
Type for compressing/decomrpessing a buffer.
Enumerator | |
---|---|
PFC_JPEG | JPEG. |
PFC_PNG | PNG. |
PFC_WEBP | WEPB. |
Definition at line 64 of file PFCImageFile.h.
PFCImageFile | ( | ) |
Constructs empty PFCImageFile, to be filled with LoadImageFile()
PFCImageFile | ( | int | width, |
int | height, | ||
const PFCImageFile & | model | ||
) |
Constructs PFCImageFile with allocation for image of given size and format.
width | [in] - width |
height | [in] - height |
model | [in] - already loaded PFCImageFile, new image will inherit pixel format and original metadata from the model |
PFCImageFile | ( | int | width, |
int | height, | ||
int | bytes_per_pixel, | ||
int | stride | ||
) |
Constructs PFCImageFile with allocation for image of given size.
width | [in] - width |
height | [in] - height |
bytes_per_pixel | [in] - bytes per pixel |
stride | [in] - stride |
int bytes_per_pixel |
bytes per pixel
Definition at line 164 of file PFCImageFile.h.
int height |
image height
Definition at line 162 of file PFCImageFile.h.
unsigned char* raw_image |
image data. Can be loaded directly into PFCIMAGE
Definition at line 158 of file PFCImageFile.h.
bool sourceSRGB |
set to true if the input image is determined to be in sRGB
Definition at line 168 of file PFCImageFile.h.
int stride |
image stride
Definition at line 166 of file PFCImageFile.h.
int width |
image width
Definition at line 160 of file PFCImageFile.h.