Perfectly Clear SDK Documentation  8.3.0.146
PFCImageFile Class Reference

PFCImageFile Class to encapsulate file handling. More...

#include <PFCImageFile.h>

Public Member Functions

PFC_FILE_LOAD_STATUS LoadImageFile (const char *filename, bool bConvertToSRGB, const char *iccFolderPath)
 Load JPEG from file on disk. More...
 
bool SaveImageFile (const char *filename, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata)
 Write image data to file. More...
 

Data Fields

unsigned char * raw_image = NULL
 
int width
 
int height
 
int bytes_per_pixel
 
int stride
 
bool sourceSRGB
 
int jpeg_color_space
 

Detailed Description

PFCImageFile Class to encapsulate file handling.

This is an optional class you can use to read and write JPEG files, manage EXIF metadata and perform color space conversion (to / from sRGB). At this time, only RGB formatted JPEG images are supported. Basic usage:

PFCImageFile originalImageFile;
bool bConvertToSRGB = true;
const char* pathToSupportFilesFolder = NULL;
PFC_FILE_LOAD_STATUS st = originalImageFile.LoadImageFile(inname, bConvertToSRGB, pathToSupportFilesFolder);

Then, load PFCIMAGE with this data:

im.width = originalImageFile.width;
im.height = originalImageFile.height;
im.stride = originalImageFile.stride;
im.data = originalImageFile.raw_image;

Correct the image:

Then write image back to disk:

bool bConvertToOriginalColorSpace = true;
bool bPreserveOriginalMetadata = true;
originalImageFile.SaveImageFile(outname, 90, bConvertToOriginalColorSpace, bPreserveOriginalMetadata);

Definition at line 64 of file PFCImageFile.h.

Member Function Documentation

◆ LoadImageFile()

PFC_FILE_LOAD_STATUS LoadImageFile ( const char *  filename,
bool  bConvertToSRGB,
const char *  iccFolderPath 
)

Load JPEG from file on disk.

Parameters
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
Returns
Returns enum PFC_FILE_LOAD_STATUS showing file read status

◆ SaveImageFile()

bool SaveImageFile ( const char *  filename,
int  jpegQuality,
bool  bConvertToOriginalColorSpace,
bool  bEmbedOriginalMetadata 
)

Write image data to file.

Parameters
filename[in] - filename to write to
jpegQuality[in] - Compression quality from zero (lowest) to 100 (highest quality). We recommend 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

Field Documentation

◆ bytes_per_pixel

int bytes_per_pixel

bytes per pixel

Definition at line 100 of file PFCImageFile.h.

◆ height

int height

image height

Definition at line 98 of file PFCImageFile.h.

◆ jpeg_color_space

int jpeg_color_space

JPEG Color Space = JCS_RGB or JCS_GRAYSCALE for grayscale images

Definition at line 107 of file PFCImageFile.h.

◆ raw_image

unsigned char* raw_image = NULL

image data. Can be loaded directly into PFCIMAGE

im.data = myPFCImagFile.raw_image

Definition at line 94 of file PFCImageFile.h.

◆ sourceSRGB

bool sourceSRGB

set to true if the input image is determined to be in sRGB

Definition at line 104 of file PFCImageFile.h.

◆ stride

int stride

image stride

Definition at line 102 of file PFCImageFile.h.

◆ width

int width

image width

Definition at line 96 of file PFCImageFile.h.


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