diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/common/utils.h | 2 | ||||
-rw-r--r-- | utils/common/vprf.c | 4 | ||||
-rw-r--r-- | utils/common/xgetopt.c | 124 | ||||
-rw-r--r-- | utils/jpgicc/jpgicc.c | 115 | ||||
-rw-r--r-- | utils/linkicc/linkicc.c | 316 | ||||
-rw-r--r-- | utils/psicc/psicc.c | 79 | ||||
-rw-r--r-- | utils/tificc/tificc.c | 120 | ||||
-rw-r--r-- | utils/transicc/transicc.c | 49 |
8 files changed, 421 insertions, 388 deletions
diff --git a/utils/common/utils.h b/utils/common/utils.h index 7422e91..f2d65b7 100644 --- a/utils/common/utils.h +++ b/utils/common/utils.h @@ -67,8 +67,6 @@ void FatalError(const char *frm, ...); extern int xoptind; extern char *xoptarg; -extern int xopterr; -extern char SW; int xgetopt(int argc, char *argv[], char *optionS); diff --git a/utils/common/vprf.c b/utils/common/vprf.c index 7523f6f..9f7d228 100644 --- a/utils/common/vprf.c +++ b/utils/common/vprf.c @@ -142,7 +142,7 @@ void PrintBuiltins(void) "\t*Gray22 - Monochrome of Gamma 2.2\n" "\t*Gray30 - Monochrome of Gamma 3.0\n" "\t*null - Monochrome black for all input\n" - "\t*Lin2222- CMYK linearization of gamma 2.2 on each channel\n"); + "\t*Lin2222- CMYK linearization of gamma 2.2 on each channel\n\n"); } @@ -231,7 +231,7 @@ void PrintRenderingIntents(void) char* Descriptions[200]; cmsUInt32Number n, i; - fprintf(stderr, "%ct<n> rendering intent:\n\n", SW); + fprintf(stderr, "-t<n> rendering intent:\n\n"); n = cmsGetSupportedIntents(200, Codes, Descriptions); diff --git a/utils/common/xgetopt.c b/utils/common/xgetopt.c index a3511a6..39764f3 100644 --- a/utils/common/xgetopt.c +++ b/utils/common/xgetopt.c @@ -1,78 +1,100 @@ -/* - getopt.c -*/ +//--------------------------------------------------------------------------------- +// +// Little Color Management System +// Copyright (c) 1998-2020 Marti Maria Saguer +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the Software +// is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +//--------------------------------------------------------------------------------- +// +// xgetopt.c -- loosely based on System V getopt() +// +// option ::= SW [optLetter]* [argLetter space* argument] +// -#include <errno.h> #include <string.h> #include <stdio.h> -int xoptind = 1; /* index of which argument is next */ -char *xoptarg; /* pointer to argument of current option */ -int xopterr = 0; /* allow error message */ +int xoptind = 1; +char *xoptarg; -static char *letP = NULL; /* remember next option char's location */ -char SW = '-'; /* DOS switch character, either '-' or '/' */ +static char *nextArg = NULL; -/* - Parse the command line options, System V style. +#define SW '-' - Standard option syntax is: - option ::= SW [optLetter]* [argLetter space* argument] - -*/ - -int xgetopt(int argc, char *argv[], char *optionS) +int xgetopt(int argc, char* argv[], char* optionS) { unsigned char ch; - char *optP; + char* optP; - if (SW == 0) { - SW = '/'; - } + if (argc > xoptind) + { - - if (argc > xoptind) { - - if (letP == NULL) { - if ((letP = argv[xoptind]) == NULL || - *(letP++) != SW) goto gopEOF; - - //if (*letP == SW) { - // xoptind++; goto gopEOF; - //} + if (nextArg == NULL) + { + if ((nextArg = argv[xoptind]) == NULL || *(nextArg++) != SW) goto end_eof; } - if (0 == (ch = *(letP++))) { - xoptind++; goto gopEOF; + + if ((ch = *(nextArg++)) == 0) + { + xoptind++; + goto end_eof; } - if (':' == ch || (optP = strchr(optionS, ch)) == NULL) - goto gopError; - if (':' == *(++optP)) { + + if (ch == ':' || (optP = strchr(optionS, ch)) == NULL) + goto end_error; + + if (*(++optP) == ':') + { xoptind++; - if (0 == *letP) { - if (argc <= xoptind) goto gopError; - letP = argv[xoptind++]; + + if (*nextArg == 0) + { + if (argc <= xoptind) goto end_error; + nextArg = argv[xoptind++]; } - xoptarg = letP; - letP = NULL; - } else { - if (0 == *letP) { + + xoptarg = nextArg; + nextArg = NULL; + + } + else + { + if (*nextArg == 0) + { xoptind++; - letP = NULL; + nextArg = NULL; } + xoptarg = NULL; } + return ch; } -gopEOF: - xoptarg = letP = NULL; + +end_eof: + xoptarg = nextArg = NULL; return EOF; -gopError: +end_error: xoptarg = NULL; - errno = EINVAL; - if (xopterr) - perror ("get command line option"); - return ('?'); + return '?'; } diff --git a/utils/jpgicc/jpgicc.c b/utils/jpgicc/jpgicc.c index 2d6fc13..e630138 100644 --- a/utils/jpgicc/jpgicc.c +++ b/utils/jpgicc/jpgicc.c @@ -1026,82 +1026,63 @@ int TransformImage(char *cDefInpProf, char *cOutputProf) } -// Simply print help - static void Help(int level) { - fprintf(stderr, "little cms ICC profile applier for JPEG - v3.2 [LittleCMS %2.2f]\n\n", LCMS_VERSION / 1000.0); - - switch(level) { - - default: - case 0: - fprintf(stderr, "usage: jpgicc [flags] input.jpg output.jpg\n"); + UTILS_UNUSED_PARAMETER(level); - fprintf(stderr, "\nflags:\n\n"); - fprintf(stderr, "%cv - Verbose\n", SW); - fprintf(stderr, "%ci<profile> - Input profile (defaults to sRGB)\n", SW); - fprintf(stderr, "%co<profile> - Output profile (defaults to sRGB)\n", SW); + fprintf(stderr, "usage: jpgicc [flags] input.jpg output.jpg\n"); - PrintRenderingIntents(); + fprintf(stderr, "\nflags:\n\n"); + fprintf(stderr, "-v - Verbose\n"); + fprintf(stderr, "-i<profile> - Input profile (defaults to sRGB)\n"); + fprintf(stderr, "-o<profile> - Output profile (defaults to sRGB)\n"); + PrintBuiltins(); - fprintf(stderr, "%cb - Black point compensation\n", SW); - fprintf(stderr, "%cd<0..1> - Observer adaptation state (abs.col. only)\n", SW); - fprintf(stderr, "%cn - Ignore embedded profile\n", SW); - fprintf(stderr, "%ce - Embed destination profile\n", SW); - fprintf(stderr, "%cs<new profile> - Save embedded profile as <new profile>\n", SW); + PrintRenderingIntents(); - fprintf(stderr, "\n"); - fprintf(stderr, "%cc<0,1,2,3> - Precalculates transform (0=Off, 1=Normal, 2=Hi-res, 3=LoRes) [defaults to 1]\n", SW); - fprintf(stderr, "\n"); + fprintf(stderr, "-b - Black point compensation\n"); + fprintf(stderr, "-d<0..1> - Observer adaptation state (abs.col. only)\n"); + fprintf(stderr, "-n - Ignore embedded profile\n"); + fprintf(stderr, "-e - Embed destination profile\n"); + fprintf(stderr, "-s<new profile> - Save embedded profile as <new profile>\n"); - fprintf(stderr, "%cp<profile> - Soft proof profile\n", SW); - fprintf(stderr, "%cm<0,1,2,3> - SoftProof intent\n", SW); - fprintf(stderr, "%cg - Marks out-of-gamut colors on softproof\n", SW); - fprintf(stderr, "%c!<r>,<g>,<b> - Out-of-gamut marker channel values\n", SW); + fprintf(stderr, "\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "%cq<0..100> - Output JPEG quality\n", SW); + fprintf(stderr, "-c<0,1,2,3> - Precalculates transform (0=Off, 1=Normal, 2=Hi-res, 3=LoRes) [defaults to 1]\n"); + fprintf(stderr, "\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "%ch<0,1,2,3> - More help\n", SW); - break; + fprintf(stderr, "-p<profile> - Soft proof profile\n"); + fprintf(stderr, "-m<0,1,2,3> - SoftProof intent\n"); + fprintf(stderr, "-g - Marks out-of-gamut colors on softproof\n"); + fprintf(stderr, "-!<r>,<g>,<b> - Out-of-gamut marker channel values\n"); - case 1: + fprintf(stderr, "\n"); + fprintf(stderr, "-q<0..100> - Output JPEG quality\n"); - fprintf(stderr, "Examples:\n\n" - "To color correct from scanner to sRGB:\n" - "\tjpgicc %ciscanner.icm in.jpg out.jpg\n" - "To convert from monitor1 to monitor2:\n" - "\tjpgicc %cimon1.icm %comon2.icm in.jpg out.jpg\n" - "To make a CMYK separation:\n" - "\tjpgicc %coprinter.icm inrgb.jpg outcmyk.jpg\n" - "To recover sRGB from a CMYK separation:\n" - "\tjpgicc %ciprinter.icm incmyk.jpg outrgb.jpg\n" - "To convert from CIELab ITU/Fax JPEG to sRGB\n" - "\tjpgicc in.jpg out.jpg\n\n", - SW, SW, SW, SW, SW); - break; + fprintf(stderr, "Examples:\n\n" + "To color correct from scanner to sRGB:\n" + "\tjpgicc -iscanner.icm in.jpg out.jpg\n" + "To convert from monitor1 to monitor2:\n" + "\tjpgicc -imon1.icm -omon2.icm in.jpg out.jpg\n" + "To make a CMYK separation:\n" + "\tjpgicc -oprinter.icm inrgb.jpg outcmyk.jpg\n" + "To recover sRGB from a CMYK separation:\n" + "\tjpgicc -iprinter.icm incmyk.jpg outrgb.jpg\n" + "To convert from CIELab ITU/Fax JPEG to sRGB\n" + "\tjpgicc in.jpg out.jpg\n\n"); - case 2: - PrintBuiltins(); - break; - case 3: + fprintf(stderr, "This program is intended to be a demo of the Little CMS\n" + "color engine. Both lcms and this program are open source.\n" + "You can obtain both in source code at https://www.littlecms.com\n" + "For suggestions, comments, bug reports etc. send mail to\n" + "info@littlecms.com\n\n"); - fprintf(stderr, "This program is intended to be a demo of the little cms\n" - "engine. Both lcms and this program are freeware. You can\n" - "obtain both in source code at http://www.littlecms.com\n" - "For suggestions, comments, bug reports etc. send mail to\n" - "marti@littlecms.com\n\n"); - break; - } - - exit(0); + exit(0); } @@ -1112,11 +1093,22 @@ void HandleSwitches(int argc, char *argv[]) { int s; - while ((s=xgetopt(argc,argv,"bBnNvVGgh:H:i:I:o:O:P:p:t:T:c:C:Q:q:M:m:L:l:eEs:S:!:D:d:")) != EOF) { + while ((s=xgetopt(argc,argv,"bBnNvVGgh:H:i:I:o:O:P:p:t:T:c:C:Q:q:M:m:L:l:eEs:S:!:D:d:-:")) != EOF) { switch (s) { + case '-': + if (strcmp(xoptarg, "help") == 0) + { + Help(0); + } + else + { + FatalError("Unknown option - run without args to see valid ones.\n"); + } + break; + case 'b': case 'B': BlackPointCompensation = TRUE; @@ -1236,6 +1228,11 @@ void HandleSwitches(int argc, char *argv[]) int main(int argc, char* argv[]) { + + fprintf(stderr, "Little CMS ICC profile applier for JPEG - v3.3 [LittleCMS %2.2f]\n\n", LCMS_VERSION / 1000.0); + fprintf(stderr, "Copyright (c) 1998-2020 Marti Maria Saguer. See COPYING file for details.\n"); + fflush(stderr); + InitUtils("jpgicc"); HandleSwitches(argc, argv); diff --git a/utils/linkicc/linkicc.c b/utils/linkicc/linkicc.c index 85a5b2c..507d4a9 100644 --- a/utils/linkicc/linkicc.c +++ b/utils/linkicc/linkicc.c @@ -49,71 +49,57 @@ static cmsFloat64Number Version = 4.3; static int Help(int level) { - switch (level) { - - default: - case 0: - - fprintf(stderr, "\nlinkicc: Links profiles into a single devicelink.\n"); - - fprintf(stderr, "\n"); - fprintf(stderr, "usage: linkicc [flags] <profiles>\n\n"); - fprintf(stderr, "flags:\n\n"); - fprintf(stderr, "%co<profile> - Output devicelink profile. [defaults to 'devicelink.icc']\n", SW); - - PrintRenderingIntents(); - - fprintf(stderr, "%cc<0,1,2> - Precision (0=LowRes, 1=Normal, 2=Hi-res) [defaults to 1]\n", SW); - fprintf(stderr, "%cn<gridpoints> - Alternate way to set precision, number of CLUT points\n", SW); - fprintf(stderr, "%cd<description> - description text (quotes can be used)\n", SW); - fprintf(stderr, "%cy<copyright> - copyright notice (quotes can be used)\n", SW); - - fprintf(stderr, "\n%ck<0..400> - Ink-limiting in %% (CMYK only)\n", SW); - fprintf(stderr, "%c8 - Creates 8-bit devicelink\n", SW); - fprintf(stderr, "%cx - Creatively, guess deviceclass of resulting profile.\n", SW); - fprintf(stderr, "%cb - Black point compensation\n", SW); - fprintf(stderr, "%ca<0..1> - Observer adaptation state (abs.col. only)\n\n", SW); - fprintf(stderr, "%cl - Use linearization curves (may affect accuracy)\n", SW); - fprintf(stderr, "%cr<v.r> - Profile version. (CAUTION: may change the profile implementation)\n", SW); - fprintf(stderr, "\n"); - fprintf(stderr, "Colorspaces must be paired except Lab/XYZ, that can be interchanged.\n\n"); - - fprintf(stderr, "%ch<0,1,2,3> - More help\n", SW); - break; - - case 1: - PrintBuiltins(); - break; - - case 2: - - fprintf(stderr, "\nExamples:\n\n" - "To create 'devicelink.icm' from a.icc to b.icc:\n" - "\tlinkicc a.icc b.icc\n\n" - "To create 'out.icc' from sRGB to cmyk.icc:\n" - "\tlinkicc -o out.icc *sRGB cmyk.icc\n\n" - "To create a sRGB input profile working in Lab:\n" - "\tlinkicc -x -o sRGBLab.icc *sRGB *Lab\n\n" - "To create a XYZ -> sRGB output profile:\n" - "\tlinkicc -x -o sRGBLab.icc *XYZ *sRGB\n\n" - "To create a abstract profile doing softproof for cmyk.icc:\n" - "\tlinkicc -t1 -x -o softproof.icc *Lab cmyk.icc cmyk.icc *Lab\n\n" - "To create a 'grayer' sRGB input profile:\n" - "\tlinkicc -x -o grayer.icc *sRGB gray.icc gray.icc *Lab\n\n" - "To embed ink limiting into a cmyk output profile:\n" - "\tlinkicc -x -o cmyklimited.icc -k 250 cmyk.icc *Lab\n\n"); - break; - - case 3: - - fprintf(stderr, "This program is intended to be a demo of the little cms\n" - "engine. Both lcms and this program are freeware. You can\n" - "obtain both in source code at http://www.littlecms.com\n" - "For suggestions, comments, bug reports etc. send mail to\n" - "info@littlecms.com\n\n"); - } - - exit(0); + UTILS_UNUSED_PARAMETER(level); + + fprintf(stderr, "\nlinkicc: Links profiles into a single devicelink.\n"); + + fprintf(stderr, "\n"); + fprintf(stderr, "usage: linkicc [flags] <profiles>\n\n"); + fprintf(stderr, "flags:\n\n"); + fprintf(stderr, "-o<profile> - Output devicelink profile. [defaults to 'devicelink.icc']\n"); + + PrintRenderingIntents(); + + fprintf(stderr, "-c<0,1,2> - Precision (0=LowRes, 1=Normal, 2=Hi-res) [defaults to 1]\n"); + fprintf(stderr, "-n<gridpoints> - Alternate way to set precision, number of CLUT points\n"); + fprintf(stderr, "-d<description> - description text (quotes can be used)\n"); + fprintf(stderr, "-y<copyright> - copyright notice (quotes can be used)\n"); + + fprintf(stderr, "\n-k<0..400> - Ink-limiting in %% (CMYK only)\n"); + fprintf(stderr, "-8 - Creates 8-bit devicelink\n"); + fprintf(stderr, "-x - Creatively, guess deviceclass of resulting profile.\n"); + fprintf(stderr, "-b - Black point compensation\n"); + fprintf(stderr, "-a<0..1> - Observer adaptation state (abs.col. only)\n\n"); + fprintf(stderr, "-l - Use linearization curves (may affect accuracy)\n"); + fprintf(stderr, "-r<v.r> - Profile version. (CAUTION: may change the profile implementation)\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "Colorspaces must be paired except Lab/XYZ, that can be interchanged.\n\n"); + + PrintBuiltins(); + + fprintf(stderr, "\nExamples:\n\n" + "To create 'devicelink.icm' from a.icc to b.icc:\n" + "\tlinkicc a.icc b.icc\n\n" + "To create 'out.icc' from sRGB to cmyk.icc:\n" + "\tlinkicc -o out.icc *sRGB cmyk.icc\n\n" + "To create a sRGB input profile working in Lab:\n" + "\tlinkicc -x -o sRGBLab.icc *sRGB *Lab\n\n" + "To create a XYZ -> sRGB output profile:\n" + "\tlinkicc -x -o sRGBLab.icc *XYZ *sRGB\n\n" + "To create a abstract profile doing softproof for cmyk.icc:\n" + "\tlinkicc -t1 -x -o softproof.icc *Lab cmyk.icc cmyk.icc *Lab\n\n" + "To create a 'grayer' sRGB input profile:\n" + "\tlinkicc -x -o grayer.icc *sRGB gray.icc gray.icc *Lab\n\n" + "To embed ink limiting into a cmyk output profile:\n" + "\tlinkicc -x -o cmyklimited.icc -k 250 cmyk.icc *Lab\n\n"); + + fprintf(stderr, "This program is intended to be a demo of the Little CMS\n" + "color engine. Both lcms and this program are open source.\n" + "You can obtain both in source code at https://www.littlecms.com\n" + "For suggestions, comments, bug reports etc. send mail to\n" + "info@littlecms.com\n\n"); + + exit(0); } // The toggles stuff @@ -122,115 +108,124 @@ void HandleSwitches(int argc, char *argv[]) { int s; - while ((s = xgetopt(argc,argv,"a:A:BbC:c:D:d:h:H:k:K:lLn:N:O:o:r:R:T:t:V:v:xX8y:Y:")) != EOF) { + while ((s = xgetopt(argc,argv,"a:A:BbC:c:D:d:h:H:k:K:lLn:N:O:o:r:R:T:t:V:v:xX8y:Y:-:")) != EOF) { switch (s) { + case '-': + if (strcmp(xoptarg, "help") == 0) + { + Help(0); + } + else + { + FatalError("Unknown option - run without args to see valid ones.\n"); + } + break; + + case 'a': + case 'A': + ObserverAdaptationState = atof(xoptarg); + if (ObserverAdaptationState < 0 || + ObserverAdaptationState > 1.0) + FatalError("Adaptation state should be 0..1"); + break; + + case 'b': + case 'B': + BlackPointCompensation = TRUE; + break; + + case 'c': + case 'C': + PrecalcMode = atoi(xoptarg); + if (PrecalcMode < 0 || PrecalcMode > 2) { + FatalError("Unknown precalc mode '%d'", PrecalcMode); + } + break; + + case 'd': + case 'D': + // Doing that is correct and safe: Description points to memory allocated in the command line. + // same for Copyright and output devicelink. + Description = xoptarg; + break; + + case 'h': + case 'H': + Help(atoi(xoptarg)); + return; + + case 'k': + case 'K': + InkLimit = atof(xoptarg); + if (InkLimit < 0.0 || InkLimit > 400.0) { + FatalError("Ink limit must be 0%%..400%%"); + } + break; - case 'a': - case 'A': - ObserverAdaptationState = atof(xoptarg); - if (ObserverAdaptationState < 0 || - ObserverAdaptationState > 1.0) - FatalError("Adaptation state should be 0..1"); - break; - - case 'b': - case 'B': - BlackPointCompensation = TRUE; - break; - - case 'c': - case 'C': - PrecalcMode = atoi(xoptarg); - if (PrecalcMode < 0 || PrecalcMode > 2) { - FatalError("Unknown precalc mode '%d'", PrecalcMode); - } - break; - - case 'd': - case 'D': - // Doing that is correct and safe: Description points to memory allocated in the command line. - // same for Copyright and output devicelink. - Description = xoptarg; - break; - - case 'h': - case 'H': - Help(atoi(xoptarg)); - return; - - case 'k': - case 'K': - InkLimit = atof(xoptarg); - if (InkLimit < 0.0 || InkLimit > 400.0) { - FatalError("Ink limit must be 0%%..400%%"); - } - break; - - - case 'l': - case 'L': KeepLinearization = TRUE; - break; - - case 'n': - case 'N': - if (PrecalcMode != 1) { - FatalError("Precalc mode already specified"); - } - NumOfGridPoints = atoi(xoptarg); - break; - - case 'o': - case 'O': - cOutProf = xoptarg; - break; - - - case 'r': - case 'R': - Version = atof(xoptarg); - if (Version < 2.0 || Version > 4.3) { - fprintf(stderr, "WARNING: lcms was not aware of this version, tag types may be wrong!\n"); - } - break; - - case 't': - case 'T': - Intent = atoi(xoptarg); // Will be validated latter on - break; - case 'V': - case 'v': - Verbose = atoi(xoptarg); - if (Verbose < 0 || Verbose > 3) { - FatalError("Unknown verbosity level '%d'", Verbose); - } - break; + case 'l': + case 'L': KeepLinearization = TRUE; + break; - case '8': - lUse8bits = TRUE; - break; + case 'n': + case 'N': + if (PrecalcMode != 1) { + FatalError("Precalc mode already specified"); + } + NumOfGridPoints = atoi(xoptarg); + break; + case 'o': + case 'O': + cOutProf = xoptarg; + break; - case 'y': - case 'Y': - Copyright = xoptarg; - break; + case 'r': + case 'R': + Version = atof(xoptarg); + if (Version < 2.0 || Version > 4.3) { + fprintf(stderr, "WARNING: lcms was not aware of this version, tag types may be wrong!\n"); + } + break; + + case 't': + case 'T': + Intent = atoi(xoptarg); // Will be validated latter on + break; + + case 'V': + case 'v': + Verbose = atoi(xoptarg); + if (Verbose < 0 || Verbose > 3) { + FatalError("Unknown verbosity level '%d'", Verbose); + } + break; + case '8': + lUse8bits = TRUE; + break; - case 'x': - case 'X': TagResult = TRUE; - break; + case 'y': + case 'Y': + Copyright = xoptarg; + break; - - default: - FatalError("Unknown option - run without args to see valid ones.\n"); - } + + case 'x': + case 'X': TagResult = TRUE; + break; + + + default: + + FatalError("Unknown option - run without args to see valid ones.\n"); + } } } @@ -275,7 +270,8 @@ int main(int argc, char *argv[]) cmsHTRANSFORM hTransform = NULL; // Here we are - fprintf(stderr, "little cms ICC device link generator - v2.2 [LittleCMS %2.2f]\n", LCMS_VERSION / 1000.0); + fprintf(stderr, "Little CMS ICC device link generator - v3.0 [LittleCMS %2.2f]\n", LCMS_VERSION / 1000.0); + fprintf(stderr, "Copyright (c) 1998-2020 Marti Maria Saguer. See COPYING file for details.\n"); fflush(stderr); // Initialize diff --git a/utils/psicc/psicc.c b/utils/psicc/psicc.c index 54b0093..0feabd3 100644 --- a/utils/psicc/psicc.c +++ b/utils/psicc/psicc.c @@ -37,6 +37,35 @@ static int PrecalcMode = 1; static int NumOfGridPoints = 0; + +static +void Help(void) +{ + fprintf(stderr, "usage: psicc [flags] [<Output file>]\n\n"); + + fprintf(stderr, "flags:\n\n"); + + fprintf(stderr, "-i<profile> - Input profile: Generates Color Space Array (CSA)\n"); + fprintf(stderr, "-o<profile> - Output profile: Generates Color Rendering Dictionary(CRD)\n"); + + fprintf(stderr, "-t<0,1,2,3> - Intent (0=Perceptual, 1=Colorimetric, 2=Saturation, 3=Absolute)\n"); + + fprintf(stderr, "-b - Black point compensation (CRD only)\n"); + fprintf(stderr, "-u - Do NOT generate resource name on CRD\n"); + fprintf(stderr, "-c<0,1,2> - Precision (0=LowRes, 1=Normal (default), 2=Hi-res) (CRD only)\n"); + fprintf(stderr, "-n<gridpoints> - Alternate way to set precission, number of CLUT points (CRD only)\n"); + + fprintf(stderr, "\n"); + fprintf(stderr, "If no output file is specified, output goes to stdout.\n\n"); + fprintf(stderr, "This program is intended to be a demo of the little cms\n" + "engine. Both lcms and this program are freeware. You can\n" + "obtain both in source code at https://www.littlecms.com\n" + "For suggestions, comments, bug reports etc. send mail to\n" + "info@littlecms.com\n\n"); + + exit(0); +} + // The toggles stuff static @@ -44,10 +73,21 @@ void HandleSwitches(int argc, char *argv[]) { int s; - while ((s = xgetopt(argc,argv,"uUbBI:i:O:o:T:t:c:C:n:N:")) != EOF) { - - switch (s){ - + while ((s = xgetopt(argc,argv,"uUbBI:i:O:o:T:t:c:C:n:N:-:")) != EOF) { + + switch (s) + { + + case '-': + if (strcmp(xoptarg, "help") == 0) + { + Help(); + } + else + { + FatalError("Unknown option - run without args to see valid ones.\n"); + } + break; case 'i': case 'I': @@ -99,34 +139,7 @@ void HandleSwitches(int argc, char *argv[]) } } -static -void Help(void) -{ - fprintf(stderr, "little CMS ICC PostScript generator - v2.1 [LittleCMS %2.2f]\n", LCMS_VERSION / 1000.0); - - fprintf(stderr, "usage: psicc [flags] [<Output file>]\n\n"); - fprintf(stderr, "flags:\n\n"); - - fprintf(stderr, "%ci<profile> - Input profile: Generates Color Space Array (CSA)\n", SW); - fprintf(stderr, "%co<profile> - Output profile: Generates Color Rendering Dictionary(CRD)\n", SW); - - fprintf(stderr, "%ct<0,1,2,3> - Intent (0=Perceptual, 1=Colorimetric, 2=Saturation, 3=Absolute)\n", SW); - - fprintf(stderr, "%cb - Black point compensation (CRD only)\n", SW); - fprintf(stderr, "%cu - Do NOT generate resource name on CRD\n", SW); - fprintf(stderr, "%cc<0,1,2> - Precision (0=LowRes, 1=Normal (default), 2=Hi-res) (CRD only)\n", SW); - fprintf(stderr, "%cn<gridpoints> - Alternate way to set precission, number of CLUT points (CRD only)\n", SW); - - fprintf(stderr, "\n"); - fprintf(stderr, "If no output file is specified, output goes to stdout.\n\n"); - fprintf(stderr, "This program is intended to be a demo of the little cms\n" - "engine. Both lcms and this program are freeware. You can\n" - "obtain both in source code at http://www.littlecms.com\n" - "For suggestions, comments, bug reports etc. send mail to\n" - "info@littlecms.com\n\n"); - exit(0); -} static @@ -199,6 +212,10 @@ int main(int argc, char *argv[]) { int nargs; + fprintf(stderr, "Little CMS ICC PostScript generator - v2.1 [LittleCMS %2.2f]\n", LCMS_VERSION / 1000.0); + fprintf(stderr, "Copyright (c) 1998-2020 Marti Maria Saguer. See COPYING file for details.\n"); + fflush(stderr); + // Initialize InitUtils("psicc"); diff --git a/utils/tificc/tificc.c b/utils/tificc/tificc.c index 4cf8ec8..ddb77b5 100644 --- a/utils/tificc/tificc.c +++ b/utils/tificc/tificc.c @@ -928,82 +928,65 @@ int TransformImage(TIFF* in, TIFF* out, const char *cDefInpProf) static void Help(int level) { - fprintf(stderr, "little cms ICC profile applier for TIFF - v6.2 [LittleCMS %2.2f]\n\n", LCMS_VERSION / 1000.0); - fflush(stderr); + UTILS_UNUSED_PARAMETER(level); - switch(level) { + fprintf(stderr, "usage: tificc [flags] input.tif output.tif\n"); - default: - case 0: + fprintf(stderr, "\nflags:\n\n"); + fprintf(stderr, "-v - Verbose\n"); + fprintf(stderr, "-i<profile> - Input profile (defaults to sRGB)\n"); + fprintf(stderr, "-o<profile> - Output profile (defaults to sRGB)\n"); + fprintf(stderr, "-l<profile> - Transform by device-link profile\n"); - fprintf(stderr, "usage: tificc [flags] input.tif output.tif\n"); + PrintBuiltins(); - fprintf(stderr, "\nflags:\n\n"); - fprintf(stderr, "%cv - Verbose\n", SW); - fprintf(stderr, "%ci<profile> - Input profile (defaults to sRGB)\n", SW); - fprintf(stderr, "%co<profile> - Output profile (defaults to sRGB)\n", SW); - fprintf(stderr, "%cl<profile> - Transform by device-link profile\n", SW); + PrintRenderingIntents(); - PrintRenderingIntents(); + fprintf(stderr, "-b - Black point compensation\n"); + fprintf(stderr, "-d<0..1> - Observer adaptation state (abs.col. only)\n"); - fprintf(stderr, "%cb - Black point compensation\n", SW); - fprintf(stderr, "%cd<0..1> - Observer adaptation state (abs.col. only)\n", SW); + fprintf(stderr, "-c<0,1,2,3> - Precalculates transform (0=Off, 1=Normal, 2=Hi-res, 3=LoRes)\n"); + fprintf(stderr, "\n"); - fprintf(stderr, "%cc<0,1,2,3> - Precalculates transform (0=Off, 1=Normal, 2=Hi-res, 3=LoRes)\n", SW); - fprintf(stderr, "\n"); + fprintf(stderr, "-w<8,16,32> - Output depth. Use 32 for floating-point\n\n"); + fprintf(stderr, "-a - Handle channels > 4 as alpha\n"); - fprintf(stderr, "%cw<8,16,32> - Output depth. Use 32 for floating-point\n\n", SW); - fprintf(stderr, "%ca - Handle channels > 4 as alpha\n", SW); + fprintf(stderr, "-n - Ignore embedded profile on input\n"); + fprintf(stderr, "-e - Embed destination profile\n"); + fprintf(stderr, "-s<new profile> - Save embedded profile as <new profile>\n"); + fprintf(stderr, "\n"); - fprintf(stderr, "%cn - Ignore embedded profile on input\n", SW); - fprintf(stderr, "%ce - Embed destination profile\n", SW); - fprintf(stderr, "%cs<new profile> - Save embedded profile as <new profile>\n", SW); - fprintf(stderr, "\n"); + fprintf(stderr, "-p<profile> - Soft proof profile\n"); + fprintf(stderr, "-m<n> - Soft proof intent\n"); + fprintf(stderr, "-g - Marks out-of-gamut colors on softproof\n"); - fprintf(stderr, "%cp<profile> - Soft proof profile\n", SW); - fprintf(stderr, "%cm<n> - Soft proof intent\n", SW); - fprintf(stderr, "%cg - Marks out-of-gamut colors on softproof\n", SW); + fprintf(stderr, "\n"); - fprintf(stderr, "\n"); - - fprintf(stderr, "%ck<0..400> - Ink-limiting in %% (CMYK only)\n", SW); - fprintf(stderr, "\n"); - fprintf(stderr, "%ch<0,1,2,3> - More help\n", SW); - break; + fprintf(stderr, "-k<0..400> - Ink-limiting in %% (CMYK only)\n"); + fprintf(stderr, "\n"); + - case 1: - - fprintf(stderr, "Examples:\n\n" - "To color correct from scanner to sRGB:\n" - "\ttificc %ciscanner.icm in.tif out.tif\n" - "To convert from monitor1 to monitor2:\n" - "\ttificc %cimon1.icm %comon2.icm in.tif out.tif\n" - "To make a CMYK separation:\n" - "\ttificc %coprinter.icm inrgb.tif outcmyk.tif\n" - "To recover sRGB from a CMYK separation:\n" - "\ttificc %ciprinter.icm incmyk.tif outrgb.tif\n" - "To convert from CIELab TIFF to sRGB\n" - "\ttificc %ci*Lab in.tif out.tif\n\n", - SW, SW, SW, SW, SW, SW); - break; + fprintf(stderr, "Examples:\n\n" + "To color correct from scanner to sRGB:\n" + "\ttificc -iscanner.icm in.tif out.tif\n" + "To convert from monitor1 to monitor2:\n" + "\ttificc -imon1.icm -omon2.icm in.tif out.tif\n" + "To make a CMYK separation:\n" + "\ttificc -oprinter.icm inrgb.tif outcmyk.tif\n" + "To recover sRGB from a CMYK separation:\n" + "\ttificc -iprinter.icm incmyk.tif outrgb.tif\n" + "To convert from CIELab TIFF to sRGB\n" + "\ttificc -i*Lab in.tif out.tif\n\n"); - case 2: - PrintBuiltins(); - break; - - case 3: - fprintf(stderr, "This program is intended to be a demo of the little cms\n" - "engine. Both lcms and this program are freeware. You can\n" - "obtain both in source code at http://www.littlecms.com\n" - "For suggestions, comments, bug reports etc. send mail to\n" - "info@littlecms.com\n\n"); + fprintf(stderr, "This program is intended to be a demo of the Little CMS\n" + "color engine. Both lcms and this program are open source.\n" + "You can obtain both in source code at https://www.littlecms.com\n" + "For suggestions, comments, bug reports etc. send mail to\n" + "info@littlecms.com\n\n"); - break; - } - fflush(stderr); exit(0); } @@ -1015,10 +998,22 @@ void HandleSwitches(int argc, char *argv[]) { int s; - while ((s=xgetopt(argc,argv,"aAeEbBw:W:nNvVGgh:H:i:I:o:O:P:p:t:T:c:C:l:L:M:m:K:k:S:s:D:d:")) != EOF) { + while ((s=xgetopt(argc,argv,"aAeEbBw:W:nNvVGgh:H:i:I:o:O:P:p:t:T:c:C:l:L:M:m:K:k:S:s:D:d:-:")) != EOF) { switch (s) { + + case '-': + if (strcmp(xoptarg, "help") == 0) + { + Help(0); + } + else + { + FatalError("Unknown option - run without args to see valid ones.\n"); + } + break; + case 'a': case 'A': StoreAsAlpha = TRUE; @@ -1144,6 +1139,11 @@ int main(int argc, char* argv[]) { TIFF *in, *out; + + fprintf(stderr, "Little CMS ICC profile applier for TIFF - v6.3 [LittleCMS %2.2f]\n\n", LCMS_VERSION / 1000.0); + fprintf(stderr, "Copyright (c) 1998-2020 Marti Maria Saguer. See COPYING file for details.\n"); + fflush(stderr); + cmsPlugin(&TiffLabPlugin); InitUtils("tificc"); diff --git a/utils/transicc/transicc.c b/utils/transicc/transicc.c index 4786687..ffed247 100644 --- a/utils/transicc/transicc.c +++ b/utils/transicc/transicc.c @@ -96,43 +96,44 @@ void Help(void) fprintf(stderr, "usage: transicc [flags] [CGATS input] [CGATS output]\n\n"); fprintf(stderr, "flags:\n\n"); - fprintf(stderr, "%cv<0..3> - Verbosity level\n", SW); + fprintf(stderr, "-v<0..3> - Verbosity level\n"); - fprintf(stderr, "%ce[op] - Encoded representation of numbers\n", SW); - fprintf(stderr, "\t%cw - use 16 bits\n", SW); - fprintf(stderr, "\t%cx - Hexadecimal\n\n", SW); + fprintf(stderr, "-e[op] - Encoded representation of numbers\n"); + fprintf(stderr, "\t-w - use 16 bits\n"); + fprintf(stderr, "\t-x - Hexadecimal\n\n"); - fprintf(stderr, "%cs - bounded mode (clip negatives and highlights)\n", SW); - fprintf(stderr, "%cq - Quantize (round decimals)\n\n", SW); + fprintf(stderr, "-s - bounded mode (clip negatives and highlights)\n"); + fprintf(stderr, "-q - Quantize (round decimals)\n\n"); - fprintf(stderr, "%ci<profile> - Input profile (defaults to sRGB)\n", SW); - fprintf(stderr, "%co<profile> - Output profile (defaults to sRGB)\n", SW); - fprintf(stderr, "%cl<profile> - Transform by device-link profile\n", SW); - - fprintf(stderr, "\nYou can use '*Lab', '*xyz' and others as built-in profiles\n\n"); + fprintf(stderr, "-i<profile> - Input profile (defaults to sRGB)\n"); + fprintf(stderr, "-o<profile> - Output profile (defaults to sRGB)\n"); + fprintf(stderr, "-l<profile> - Transform by device-link profile\n"); + + PrintBuiltins(); PrintRenderingIntents(); fprintf(stderr, "\n"); - fprintf(stderr, "%cd<0..1> - Observer adaptation state (abs.col. only)\n\n", SW); + fprintf(stderr, "-d<0..1> - Observer adaptation state (abs.col. only)\n\n"); - fprintf(stderr, "%cb - Black point compensation\n", SW); + fprintf(stderr, "-b - Black point compensation\n"); - fprintf(stderr, "%cc<0,1,2,3> Precalculates transform (0=Off, 1=Normal, 2=Hi-res, 3=LoRes)\n\n", SW); - fprintf(stderr, "%cn - Terse output, intended for pipe usage\n", SW); + fprintf(stderr, "-c<0,1,2,3> Precalculates transform (0=Off, 1=Normal, 2=Hi-res, 3=LoRes)\n\n"); + fprintf(stderr, "-n - Terse output, intended for pipe usage\n"); - fprintf(stderr, "%cp<profile> - Soft proof profile\n", SW); - fprintf(stderr, "%cm<0,1,2,3> - Soft proof intent\n", SW); - fprintf(stderr, "%cg - Marks out-of-gamut colors on softproof\n\n", SW); + fprintf(stderr, "-p<profile> - Soft proof profile\n"); + fprintf(stderr, "-m<0,1,2,3> - Soft proof intent\n"); + fprintf(stderr, "-g - Marks out-of-gamut colors on softproof\n\n"); - fprintf(stderr, "This program is intended to be a demo of the little cms\n" - "engine. Both lcms and this program are freeware. You can\n" - "obtain both in source code at http://www.littlecms.com\n" + fprintf(stderr, "This program is intended to be a demo of the Little CMS\n" + "color engine. Both lcms and this program are open source.\n" + "You can obtain both in source code at https://www.littlecms.com\n" "For suggestions, comments, bug reports etc. send mail to\n" "info@littlecms.com\n\n"); + } @@ -469,7 +470,7 @@ cmsBool OpenTransforms(void) if (cmsGetDeviceClass(hInput) == cmsSigLinkClass || cmsGetDeviceClass(hOutput) == cmsSigLinkClass) - FatalError("Use %cl flag for devicelink profiles!\n", SW); + FatalError("Use -l flag for devicelink profiles!\n"); InputColorSpace = cmsGetColorSpace(hInput); @@ -1252,7 +1253,9 @@ int main(int argc, char *argv[]) int nPatch = 0; - fprintf(stderr, "LittleCMS ColorSpace conversion calculator - 4.3 [LittleCMS %2.2f]\n", LCMS_VERSION / 1000.0); + fprintf(stderr, "LittleCMS ColorSpace conversion calculator - 5.0 [LittleCMS %2.2f]\n", LCMS_VERSION / 1000.0); + fprintf(stderr, "Copyright (c) 1998-2020 Marti Maria Saguer. See COPYING file for details.\n"); + fflush(stderr); InitUtils("transicc"); |