Oyranos Color Management System API - Version 0.9.6
oymd5icc.c

Read and set the ICC profile ID.

/* cc -g -Wall `pkg-config oyranos --libs --cflags` oymd5icc.c -o oymd5icc */
#include <oyProfile_s.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct oyProfile_s_ oyProfile_s_;
int oyProfile_ToFile_ ( oyProfile_s_ * profile,
const char * file_name );
int main( int argc, char ** argv )
{
oyProfile_s * p = 0;
uint32_t * i;
uint32_t md5[4],
id[4];
int profile_pos = 1,
set_md5 = 0,
show_short = 0,
error;
if(argc == 1)
{
printf("Usage: %s [--set] [--short] icc_profile.icc\n", argv[0]);
exit(0);
}
if(strcmp(argv[profile_pos],"--set") == 0)
{
set_md5 = 1;
++profile_pos;
}
if(strcmp(argv[profile_pos],"--short") == 0)
{
show_short = 1;
++profile_pos;
}
p = oyProfile_FromFile( argv[profile_pos], 0,0 );
error = oyProfile_GetMD5(p, OY_COMPUTE, md5);
if(set_md5)
oyProfile_ToFile_( (oyProfile_s_*)p, argv[profile_pos]);
i = (uint32_t*)md5;
if(p)
{
if(show_short)
printf( "%08x%08x%08x%08x\n",
(unsigned int)i[0],(unsigned int)i[1],(unsigned int)i[2],(unsigned int)i[3] );
else
printf( "%08x%08x%08x%08x[%08x%08x%08x%08x] %s\n",
(unsigned int)i[0],(unsigned int)i[1],(unsigned int)i[2],(unsigned int)i[3],
(unsigned int)id[0],(unsigned int)id[1],(unsigned int)id[2],(unsigned int)id[3], argv[profile_pos] );
} else
fprintf(stderr, "not found: %s\n", argv[profile_pos] );
return error;
}
#define OY_COMPUTE
Definition: oyProfile_s.h:71
#define OY_FROM_PROFILE
Definition: oyProfile_s.h:70
A profile and its attributes.
Definition: oyProfile_s.h:95
int oyProfile_GetMD5(oyProfile_s *profile, int flags, uint32_t *md5)
Get the ICC profile md5 hash sum.
Definition: oyProfile_s.c:2116
OYAPI oyProfile_s *OYEXPORT oyProfile_FromFile(const char *name, uint32_t flags, oyObject_s object)
Create from file.
Definition: oyProfile_s.c:413