IccMAX 2.1.27
Color Profile Tools
|
#include <iostream>
#include <fstream>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <png.h>
#include "IccCmm.h"
#include "IccUtil.h"
#include "IccDefs.h"
#include "IccProfLibVer.h"
#include <zlib.h>
Go to the source code of this file.
Macros | |
#define | BAIL_OUT(msg) do { LOG_ERROR(msg); TRAP(); } while (0) |
#define | LOG_ERROR(msg) do { fprintf(stderr, "[ERROR] %s\n", msg); } while (0) |
#define | PNG_ICC_PROFILE_CAST (png_bytepp) |
Core and external libraries necessary for the fuzzer functionality. | |
#define | TRAP() abort() |
Typedefs | |
typedef png_bytep | png_icc_profilep |
Functions | |
int | ExtractIccProfile (png_structp png_ptr, png_infop info_ptr, unsigned char **pProfMem, unsigned int *nLen) |
bool | InjectIccProfile (const std::string &inputPng, const std::string &iccFile, const std::string &outputPng) |
int | main (int argc, char *argv[]) |
void | PrintIccProfileInfo (const unsigned char *pProfMem, unsigned int nLen, const char *outputFile) |
void | PrintPngInfo (png_structp png_ptr, png_infop info_ptr) |
void | safe_exit (const char *reason) |
void | Usage () |
#define LOG_ERROR | ( | msg | ) | do { fprintf(stderr, "[ERROR] %s\n", msg); } while (0) |
#define PNG_ICC_PROFILE_CAST (png_bytepp) |
Core and external libraries necessary for the fuzzer functionality.
This section includes the necessary headers for the Foundation framework, UIKit, Core Graphics, standard input/output, standard library, memory management, mathematical functions, Boolean type, floating-point limits, and string functions. These libraries support image processing, UI interaction, and basic C operations essential for the application.
#define TRAP | ( | ) | abort() |
typedef png_bytep png_icc_profilep |
int ExtractIccProfile | ( | png_structp | png_ptr, |
png_infop | info_ptr, | ||
unsigned char ** | pProfMem, | ||
unsigned int * | nLen | ||
) |
Extracts the ICC profile from a PNG image.
png_ptr | Pointer to the PNG structure. |
info_ptr | Pointer to the PNG info structure. |
pProfMem | Output pointer to store the ICC profile data. |
nLen | Output length of the extracted ICC profile. |
Extracts the embedded ICC profile from a PNG image.
png_ptr | Pointer to the PNG read structure. |
info_ptr | Pointer to the PNG info structure. |
pProfMem | Output pointer to store the ICC profile data. |
nLen | Output variable to store the profile data length. |
Referenced by main().
bool InjectIccProfile | ( | const std::string & | inputPng, |
const std::string & | iccFile, | ||
const std::string & | outputPng | ||
) |
Injects a new ICC profile into a PNG and writes it to disk.
inputPng | Source PNG path. |
iccFile | ICC profile file to inject. |
outputPng | Destination PNG path. |
Injects a new ICC profile into a PNG image and writes the output.
inputPng | Path to the source PNG file. |
iccFile | Path to the ICC file to embed. |
outputPng | Path to write the modified PNG file. |
References safe_exit().
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Entry point of the iccPngDump program.
This function handles command-line arguments, opens a PNG file, validates its format, and either extracts or injects an ICC profile.
argc | Argument count. |
argv | Argument vector. |
References ExtractIccProfile(), InjectIccProfile(), PrintIccProfileInfo(), PrintPngInfo(), safe_exit(), and Usage().
void PrintIccProfileInfo | ( | const unsigned char * | pProfMem, |
unsigned int | nLen, | ||
const char * | outputFile | ||
) |
Displays and optionally saves ICC profile information.
pProfMem | ICC profile memory block. |
nLen | Size of ICC data. |
outputFile | Path to write ICC (optional). |
Parses and displays ICC profile metadata, and optionally saves it to a file.
pProfMem | Pointer to the ICC profile data. |
nLen | Length of the ICC profile data in bytes. |
outputFile | Path to the output file for saving the ICC profile (optional). |
References CIccProfile, icHeader::colorSpace, CIccInfo::GetColorSpaceSigName(), OpenIccProfile(), icHeader::pcs, and icHeader::version.
Referenced by main().
void PrintPngInfo | ( | png_structp | png_ptr, |
png_infop | info_ptr | ||
) |
Prints information about a given PNG file.
png_ptr | Pointer to the PNG structure. |
info_ptr | Pointer to the PNG info structure. |
Displays detailed metadata information about a PNG image.
png_ptr | Pointer to the PNG read structure. |
info_ptr | Pointer to the PNG info structure. |
Referenced by main().
void safe_exit | ( | const char * | reason | ) |
Safely exits the program with a given reason.
reason | The reason for exiting. |
Logs an error message and exits the program safely.
reason | A string containing the reason for exiting. |
Referenced by InjectIccProfile(), and main().
void Usage | ( | ) |
Displays usage information for the program.
Displays usage information for the iccPngDump tool.
This function provides details on the correct command-line syntax.