![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Macros | |
| #define | N_ICC_HEAD_BYTES (N_ICC_MAX_BYTES + 1024u * 1024u) |
| Bytes of a file n_icc_from_file() reads to look for a JPEG, PNG or WebP profile, which those formats keep before the image data. | |
| #define | N_ICC_MAX_BYTES (16u * 1024u * 1024u) |
| Largest profile returned. | |
Functions | |
| int | n_icc_from_buffer (const unsigned char *data, size_t len, unsigned char **icc, size_t *icc_len) |
| Find the profile embedded in an image file held in memory. | |
| int | n_icc_from_file (const char *path, unsigned char **icc, size_t *icc_len) |
| Find the profile embedded in an image file. | |
| int | n_icc_is_profile (const unsigned char *data, size_t len) |
| Does a buffer look like an ICC profile: at least a header, a size field no larger than the buffer, and "acsp" at byte 36. | |
| #define N_ICC_HEAD_BYTES (N_ICC_MAX_BYTES + 1024u * 1024u) |
Bytes of a file n_icc_from_file() reads to look for a JPEG, PNG or WebP profile, which those formats keep before the image data.
Definition at line 67 of file n_icc.h.
Referenced by n_icc_from_file().
| #define N_ICC_MAX_BYTES (16u * 1024u * 1024u) |
Largest profile returned.
Real ones are a few hundred bytes to a few hundred kilobytes, a large lookup table profile a few megabytes.
Definition at line 63 of file n_icc.h.
Referenced by _from_jpeg(), _from_png(), _give(), and _tiff_file().
| int n_icc_from_buffer | ( | const unsigned char * | data, |
| size_t | len, | ||
| unsigned char ** | icc, | ||
| size_t * | icc_len ) |
Find the profile embedded in an image file held in memory.
The format is told from the buffer's first bytes, not from a name.
| data | the file's bytes, from its start |
| len | how many |
| icc | receives the profile, allocated here and released with free(), or NULL when there is none |
| icc_len | receives its length, 0 when there is none |
Definition at line 309 of file n_icc.c.
References __n_assert, _from_buffer(), and N_ICC_MORE.
Referenced by expect(), and main().
| int n_icc_from_file | ( | const char * | path, |
| unsigned char ** | icc, | ||
| size_t * | icc_len ) |
Find the profile embedded in an image file.
A TIFF's profile is read where its directory says, which may be at the end of a large file; for the other formats the first N_ICC_HEAD_BYTES are read.
| path | the file |
| icc | as n_icc_from_buffer() |
| icc_len | as n_icc_from_buffer() |
Definition at line 366 of file n_icc.c.
References __n_assert, _from_buffer(), _tiff_file(), N_ICC_FIRST_READ, N_ICC_HEAD_BYTES, and N_ICC_MORE.
Referenced by expect(), and main().
| int n_icc_is_profile | ( | const unsigned char * | data, |
| size_t | len ) |
Does a buffer look like an ICC profile: at least a header, a size field no larger than the buffer, and "acsp" at byte 36.
| data | the bytes |
| len | how many |
Definition at line 70 of file n_icc.c.
References _be32(), and N_ICC_MIN_BYTES.
Referenced by _from_jpeg(), _from_png(), _give(), _tiff_file(), and main().