![]() |
Perfectly Clear SDK Documentation
10.7.1.1191
|
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... | |
bool | SetOutputIccProfile (const char *filename) |
loads the desired ICC profile from the given path for the output image More... | |
int | exifOrientation () |
int | iISO () |
const char * | cameraModel () |
const char * | exifSoftware () |
Data Fields | |
unsigned char * | raw_image |
int | width |
int | height |
int | bytes_per_pixel |
int | stride |
bool | sourceSRGB |
PFC_FLASH_STATUS | flashStatus |
flash status from the exif section if present | |
bool | expandThumbnailImage |
expand the thumbnailImage to get thumbnail dimensions and check validity. | |
bool | hasSourceThumbnail |
set to true after loading an image and it has a valid jpeg thumbnail | |
int | sourceThumbnailWidth |
width of the loaded image thumbnail | |
int | sourceThumbnailHeight |
height of the loaded image thumnail | |
void * | outputThumbnailBuffer |
sets the jpeg compressed image content for the thumbnail to embed when saving the image. The buffer is not copied or checked and will be read at saving time. The class does not take ownership of the buffer. If set the original thumbnail data from the image will be discarded and will use the passed buffer data, the original thumbnail data will be embeded. | |
int | outputThumbnailBufferSize |
size of the compressed image content | |
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 71 of file PFCImageFile.h.
const char* cameraModel | ( | ) |
Holds the contents of the EXIF ISO tag
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. Ignored if the user has called SetOutputIccProfile. |
bEmbedOriginalMetadata | [in] - Set to true to copy EXIF data from original to output. This can be critical for images with EXIF rotation flag. |
int exifOrientation | ( | ) |
Holds the contents of the EXIF Software tag
const char* exifSoftware | ( | ) |
Holds the contents of the EXIF Camera Model tag
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 |
int iISO | ( | ) |
Holds the contents of the EXIF Orientation tag
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. Ignored if the user has called SetOutputIccProfile. |
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. Ignored if the user has called SetOutputIccProfile. |
bEmbedOriginalMetadata | [in] - Set to true to copy EXIF data from original to output. This can be critical for images with EXIF rotation flag. |
bool SetOutputIccProfile | ( | const char * | filename | ) |
loads the desired ICC profile from the given path for the output image
filename | [in] - filename to load. |
enum PFC_FILETYPE |
Type for compressing/decomrpessing a buffer.
Enumerator | |
---|---|
PFC_JPEG | JPEG. |
PFC_PNG | PNG. |
PFC_WEBP | WEPB. |
Definition at line 76 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 195 of file PFCImageFile.h.
int height |
image height
Definition at line 193 of file PFCImageFile.h.
unsigned char* raw_image |
image data. Can be loaded directly into PFCIMAGE
Definition at line 189 of file PFCImageFile.h.
bool sourceSRGB |
Set to true if the input image is tagged as being in sRGB. All images with embedded color profiles will be false, regardless of the profile's contents.
Definition at line 199 of file PFCImageFile.h.
int stride |
image stride
Definition at line 197 of file PFCImageFile.h.
int width |
image width
Definition at line 191 of file PFCImageFile.h.