From 0ceeafe90dc5055ff999c0e2d7530748bb32fed5 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Thu, 4 Oct 2007 01:00:40 +0200 Subject: add hue saturation etc. --- src/pnmlcms.c | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/pnmlcms.c b/src/pnmlcms.c index bbb785a..66c1905 100644 --- a/src/pnmlcms.c +++ b/src/pnmlcms.c @@ -10,12 +10,14 @@ int main(int argc, char **argv) { int c, i, nProf = 0; char *in_prof = NULL, *out_prof = NULL; - double gamma = 0.0; + double gamma = 0.0, bright = 0.0, contrast = 1.0, hue = 0.0; + double saturation = 0.0; + int tempSrc = 5000, tempDst = 5000; cmsHTRANSFORM hTransform; cmsHPROFILE profiles[3]; struct pnm in_pnm; - while ((c = getopt(argc, argv, "i:o:g:")) != EOF) { + while ((c = getopt(argc, argv, "i:o:g:b:c:h:s:S:D:")) != EOF) { switch (c) { case 'i': in_prof = optarg; @@ -26,12 +28,30 @@ main(int argc, char **argv) { case 'g': gamma = atof(optarg); break; + case 'b': + bright = atof(optarg); + break; + case 'c': + contrast = atof(optarg); + break; + case 'h': + hue = atof(optarg); + break; + case 's': + saturation = atof(optarg); + break; + case 'S': + tempSrc = atoi(optarg); + break; + case 'D': + tempDst = atoi(optarg); + break; + default: break; } } - if (in_prof) { profiles[nProf++] = cmsOpenProfileFromFile(in_prof, "r"); } else { @@ -49,13 +69,21 @@ main(int argc, char **argv) { gTable); } + profiles[nProf++] = cmsCreateBCHSWabstractProfile( + 10, + bright, + contrast, + hue, + saturation, + tempSrc, + tempDst); + if (out_prof) { profiles[nProf++] = cmsOpenProfileFromFile(out_prof, "r"); } else { profiles[nProf++] = cmsCreate_sRGBProfile(); } - hTransform = cmsCreateMultiprofileTransform( profiles, nProf, @@ -76,7 +104,7 @@ main(int argc, char **argv) { cmsDeleteTransform(hTransform); for (i = 0; i < nProf; i++) { - cmsCloseProfile(profiles[i]); + // cmsCloseProfile(profiles[i]); } return 0; @@ -104,5 +132,3 @@ pam_transform(FILE *in_fp, FILE *out_fp, return 0; } - - -- cgit v1.2.3