Exemplo n.º 1
0
def __get_options():
    """Return plot that chroma option parser

    Returns:
        .argparse.ArgumentParser.args

    """
    # Define parser
    description = 'Plot chromaticities in a xy or u\'v\' diagram'
    parser = argparse.ArgumentParser(description=description)
    # RGB colorspace
    parser.add_argument("-space",
                        "--colorspace",
                        help=("RGB Colorspace."),
                        type=str,
                        action='append',
                        dest='colorspaces',
                        choices=sorted(
                            list(COLORSPACES.keys()) +
                            list(PRIVATE_COLORSPACES.keys())))
    # Points
    parser.add_argument("-p",
                        "--point",
                        type=float,
                        nargs=2,
                        metavar=('x', 'y'),
                        action='append',
                        dest='points',
                        help='Display an xy point')
    # Spectrum locus
    parser.add_argument("-spectrum",
                        "--spectrum-locus",
                        action="store_true",
                        help="Display spectrum locus")
    return parser
Exemplo n.º 2
0
def __get_options():
    """ Return rgb_to_xyz option parser

    Returns:
        .argparse.ArgumentParser.args

    """
    # Define parser
    description = 'Print RGB -> RGB matrix'
    parser = argparse.ArgumentParser(description=description)
    # RGB colorspace
    colorspaces = sorted(
        list(COLORSPACES.keys()) + list(PRIVATE_COLORSPACES.keys()) +
        [XYZ_colorspace])
    parser.add_argument("-in",
                        "--in-colorspace",
                        help=("Input RGB Colorspace."),
                        type=str,
                        choices=colorspaces,
                        required=True)
    parser.add_argument("-out",
                        "--out-colorspace",
                        help=("Output RGB Colorspace."),
                        type=str,
                        choices=colorspaces,
                        required=True)
    # Get primarie matrix only
    parser.add_argument(
        "-po",
        "--primaries-only",
        help="Primaries matrix only, doesn't include white point.",
        action="store_true")
    # Output format
    parser.add_argument("-f",
                        "--format",
                        help=("Output formatting."),
                        type=str,
                        choices=['matrix', 'spimtx', 'simple'],
                        default='matrix')
    # version
    parser.add_argument('-v',
                        "--version",
                        action='version',
                        version='{0} - version {1}'.format(
                            description, __version__))
    # full version
    versions = debug_helper.get_imported_modules_versions(
        sys.modules, globals())
    versions = '{0} - version {1}\n\n{2}'.format(description, __version__,
                                                 versions)
    parser.add_argument('-V',
                        "--full-versions",
                        action=debug_helper.make_full_version_action(versions))
    return parser.parse_args()
Exemplo n.º 3
0
def __get_options():
    """Return curve_to_lut option parser

    Returns:
        .argparse.ArgumentParser.args

    """
    ## Define parser
    description = 'Create lut file corresponding to a colorspace gradation'
    parser = argparse.ArgumentParser(description=description)
    # RGB colorspace
    parser.add_argument("colorspace",
                        help=("Input RGB Colorspace."),
                        type=str,
                        choices=sorted(COLORSPACES.keys() +
                                        PRIVATE_COLORSPACES.keys()))
    # output lut
    parser.add_argument("outlutpath", help=("path to the output LUT."
                                                      " Can be a file or a "
                                                      "directory."
                                                      ), type=str)
    # type
    parser.add_argument("-t", "--out-type", help=("Output LUT type."),
                        type=str, choices=['1D_CSP', '1D_CUBE', '1D_SPI'],
                        default='1D_CUBE')
    # in range
    parser.add_argument("-ir", "--in-range", help=("In range value."),
                        type=float, default=0.0)
    # out range
    parser.add_argument("-or", "--out-range", help=("Out range value."),
                        type=float, default=1.0)
    # out lut size
    parser.add_argument("-os", "--out-lut-size", help=(
        "Output lut bit precision. Ex : 10, 16, 32."
    ), default=16, type=int)
    # direction
    parser.add_argument("-d", "--direction", help=("Direction : "
                                                   "encode or decode."),
                        type=str, choices=[Direction.ENCODE, Direction.DECODE],
                        default=Direction.ENCODE)
    # version
    parser.add_argument('-v', "--version", action='version',
                        version='{0} - version {1}'.format(description,
                                                           __version__))
    # full version
    versions = debug_helper.get_imported_modules_versions(sys.modules,
                                                          globals())
    versions = '{0} - version {1}\n\n{2}'.format(description,
                                                 __version__,
                                                 versions)
    parser.add_argument('-V', "--full-versions",
                        action=debug_helper.make_full_version_action(versions))
    return parser.parse_args()
Exemplo n.º 4
0
def __get_options():
    """ Return rgb_to_xyz option parser

    Returns:
        .argparse.ArgumentParser.args

    """
    # Define parser
    description = 'Print RGB -> RGB matrix'
    parser = argparse.ArgumentParser(description=description)
    # RGB colorspace
    colorspaces = sorted(COLORSPACES.keys() + PRIVATE_COLORSPACES.keys() + [XYZ_colorspace])
    parser.add_argument("-in", "--in-colorspace",
                        help=("Input RGB Colorspace."),
                        type=str,
                        choices=colorspaces,
                        required=True)
    parser.add_argument("-out", "--out-colorspace",
                        help=("Output RGB Colorspace."),
                        type=str,
                        choices=colorspaces,
                        required=True)
    # Get primarie matrix only
    parser.add_argument("-po", "--primaries-only",
                        help="Primaries matrix only, doesn't include white point.",
                        action="store_true")
    # Output format
    parser.add_argument("-f", "--format",
                        help=("Output formatting."),
                        type=str,
                        choices=['matrix', 'spimtx', 'simple'],
                        default='matrix')
    # version
    parser.add_argument('-v', "--version", action='version',
                        version='{0} - version {1}'.format(description,
                                                           __version__))
    # full version
    versions = debug_helper.get_imported_modules_versions(sys.modules,
                                                          globals())
    versions = '{0} - version {1}\n\n{2}'.format(description,
                                                 __version__,
                                                 versions)
    parser.add_argument('-V', "--full-versions",
                        action=debug_helper.make_full_version_action(versions))
    return parser.parse_args()
Exemplo n.º 5
0
def __get_options():
    """Return curve_to_lut option parser

    Returns:
        .argparse.ArgumentParser.args

    """
    # Define parser
    description = ('Create lut file corresponding to a colorspace or gamma '
                   'gradation')
    parser = argparse.ArgumentParser(description=description)
    # RGB colorspace
    action = parser.add_mutually_exclusive_group(required=True)
    action.add_argument("--colorspace",
                        help=("Input RGB Colorspace."),
                        type=str,
                        choices=sorted(list(COLORSPACES.keys()) +
                                       list(PRIVATE_COLORSPACES.keys())))
    action.add_argument("--gamma",
                        help="Input pure gamma gradation",
                        type=float)
    # direction
    parser.add_argument("-d", "--direction", help=("Direction : "
                                                   "encode or decode."),
                        type=str, choices=[Direction.ENCODE, Direction.DECODE],
                        default=Direction.ENCODE)
    # out lut file, type, format, ranges,  out bit depth, out cube size
    add_outlutfile_option(parser, required=True)
    add_export_lut_options(parser)
    parser.add_argument("--process-input-range", action="store_true",
                        help=("If true, input range will be computed from "
                              " colorspace gradation functions."
                              "(Colorspace only))"))
    # version
    full_version = debug_helper.get_imported_modules_versions(sys.modules,
                                                              globals())
    add_version_option(parser, description, __version__, full_version)
    # verbose
    add_silent_option(parser)
    # trace
    add_trace_option(parser)
    return parser.parse_args()
Exemplo n.º 6
0
def __get_options():
    """Return curve_to_lut option parser

    Returns:
        .argparse.ArgumentParser.args

    """
    # Define parser
    description = ('Create lut file corresponding to a colorspace or gamma '
                   'gradation')
    parser = argparse.ArgumentParser(description=description)
    # RGB colorspace
    action = parser.add_mutually_exclusive_group(required=True)
    action.add_argument("--colorspace",
                        help=("Input RGB Colorspace."),
                        type=str,
                        choices=sorted(COLORSPACES.keys() +
                                       PRIVATE_COLORSPACES.keys()))
    action.add_argument("--gamma",
                        help="Input pure gamma gradation",
                        type=float)
    # direction
    parser.add_argument("-d", "--direction", help=("Direction : "
                                                   "encode or decode."),
                        type=str, choices=[Direction.ENCODE, Direction.DECODE],
                        default=Direction.ENCODE)
    # out lut file, type, format, ranges,  out bit depth, out cube size
    add_outlutfile_option(parser, required=True)
    add_export_lut_options(parser)
    parser.add_argument("--process-input-range", action="store_true",
                        help=("If true, input range will be computed from "
                              " colorspace gradation functions."
                              "(Colorspace only))"))
    # version
    full_version = debug_helper.get_imported_modules_versions(sys.modules,
                                                              globals())
    add_version_option(parser, description, __version__, full_version)
    # verbose
    add_silent_option(parser)
    # trace
    add_trace_option(parser)
    return parser.parse_args()
Exemplo n.º 7
0
def __get_options():
    """ Return rgb_to_xyz option parser

    Returns:
        .argparse.ArgumentParser.args

    """
    # Define parser
    description = 'Print RGB -> XYZ matrix'
    parser = argparse.ArgumentParser(description=description)
    # RGB colorspace
    parser.add_argument("-c",
                        "--colorspace",
                        help=("Input RGB Colorspace."),
                        type=str,
                        choices=sorted(COLORSPACES.keys() +
                                       PRIVATE_COLORSPACES.keys()),
                        default='Rec709')
    # Output format
    parser.add_argument("-f",
                        "--format",
                        help=("Output formatting."),
                        type=str,
                        choices=['matrix', 'spimtx', 'simple'],
                        default='matrix')
    # version
    parser.add_argument('-v',
                        "--version",
                        action='version',
                        version='{0} - version {1}'.format(
                            description, __version__))
    # full version
    versions = debug_helper.get_imported_modules_versions(
        sys.modules, globals())
    versions = '{0} - version {1}\n\n{2}'.format(description, __version__,
                                                 versions)
    parser.add_argument('-V',
                        "--full-versions",
                        action=debug_helper.make_full_version_action(versions))
    return parser.parse_args()
Exemplo n.º 8
0
def __get_options():
    """Return plot that chroma option parser

    Returns:
        .argparse.ArgumentParser.args

    """
    # Define parser
    description = 'Plot chromaticities in a xy or u\'v\' diagram'
    parser = argparse.ArgumentParser(description=description)
    # RGB colorspace
    parser.add_argument("-space", "--colorspace",
                        help=("RGB Colorspace."),
                        type=str, action='append', dest='colorspaces',
                        choices=sorted(COLORSPACES.keys() +
                                       PRIVATE_COLORSPACES.keys()))
    # Points
    parser.add_argument("-p", "--point", type=float, nargs=2,
                        metavar=('x', 'y'), action='append',
                        dest='points', help='Display an xy point')
    # Spectrum locus
    parser.add_argument("-spectrum", "--spectrum-locus", action="store_true",
                        help="Display spectrum locus")
    return parser
Exemplo n.º 9
0
def __get_options():
    """ Return rgb_to_xyz option parser

    Returns:
        .argparse.ArgumentParser.args

    """
    # Define parser
    description = 'Print RGB -> XYZ matrix'
    parser = argparse.ArgumentParser(description=description)
    # RGB colorspace
    parser.add_argument("-c", "--colorspace",
                        help=("Input RGB Colorspace."),
                        type=str,
                        choices=sorted(COLORSPACES.keys() +
                                       PRIVATE_COLORSPACES.keys()),
                        default='Rec709')
    # Output format
    parser.add_argument("-f", "--format",
                        help=("Output formatting."),
                        type=str,
                        choices=['matrix', 'spimtx', 'simple'],
                        default='matrix')
    # version
    parser.add_argument('-v', "--version", action='version',
                        version='{0} - version {1}'.format(description,
                                                           __version__))
    # full version
    versions = debug_helper.get_imported_modules_versions(sys.modules,
                                                          globals())
    versions = '{0} - version {1}\n\n{2}'.format(description,
                                                 __version__,
                                                 versions)
    parser.add_argument('-V', "--full-versions",
                        action=debug_helper.make_full_version_action(versions))
    return parser.parse_args()
Exemplo n.º 10
0
def __get_options():
    """Return curve_to_lut option parser

    Returns:
        .argparse.ArgumentParser.args

    """
    ## Define parser
    description = 'Create lut file corresponding to a colorspace gradation'
    parser = argparse.ArgumentParser(description=description)
    # RGB colorspace
    parser.add_argument("colorspace",
                        help=("Input RGB Colorspace."),
                        type=str,
                        choices=sorted(COLORSPACES.keys() +
                                       PRIVATE_COLORSPACES.keys()))
    # output lut
    parser.add_argument("outlutpath",
                        help=("path to the output LUT."
                              " Can be a file or a "
                              "directory."),
                        type=str)
    # type
    parser.add_argument("-t",
                        "--out-type",
                        help=("Output LUT type."),
                        type=str,
                        choices=['1D_CSP', '1D_CUBE', '1D_SPI'],
                        default='1D_CUBE')
    # in range
    parser.add_argument("-ir",
                        "--in-range",
                        help=("In range value."),
                        type=float,
                        default=0.0)
    # out range
    parser.add_argument("-or",
                        "--out-range",
                        help=("Out range value."),
                        type=float,
                        default=1.0)
    # out lut size
    parser.add_argument("-os",
                        "--out-lut-size",
                        help=("Output lut bit precision. Ex : 10, 16, 32."),
                        default=16,
                        type=int)
    # direction
    parser.add_argument("-d",
                        "--direction",
                        help=("Direction : "
                              "encode or decode."),
                        type=str,
                        choices=[Direction.ENCODE, Direction.DECODE],
                        default=Direction.ENCODE)
    # version
    parser.add_argument('-v',
                        "--version",
                        action='version',
                        version='{0} - version {1}'.format(
                            description, __version__))
    # full version
    versions = debug_helper.get_imported_modules_versions(
        sys.modules, globals())
    versions = '{0} - version {1}\n\n{2}'.format(description, __version__,
                                                 versions)
    parser.add_argument('-V',
                        "--full-versions",
                        action=debug_helper.make_full_version_action(versions))
    return parser.parse_args()