Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/doc/pythonbindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -4044,6 +4044,9 @@ is provided for minimal color support.
Get the RGB primaries and white point of a color space with a known Color
Interop ID, as `get_color_interop_id()` finds it: a sequence of eight floats
(Rx, Ry, Gx, Gy, Bx, By, Wx, Wy, CIE 1931 xy), or None if they are unknown.
A color space of the config without such an ID, or whose ID OpenImageIO has no
primaries for, has them derived by analyzing its transforms, unless the
`colorconfig:analyze_transforms` attribute is 0.

Example:

Expand All @@ -4059,7 +4062,10 @@ This function was added in OpenImageIO 3.2.
:::{py:method} get_transfer_function_gamma (colorspace)
Get the exponent of a color space's transfer function if it decodes as a pure
power, 1.0 if it is linear, or 0 if it is neither or is unknown. Piecewise
curves such as sRGB's report 0.
curves such as sRGB's report 0. A color space whose config declares an
encoding is linear only if that encoding is linear for its reference type.
Otherwise it answers for a known Color Interop ID, or, like
`get_chromaticities()`, by analyzing transforms.

Example:

Expand Down
15 changes: 9 additions & 6 deletions src/include/OpenImageIO/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,18 +453,21 @@ class OIIO_API ColorConfig {
/// Color Interop ID
/// (https://github.com/AcademySoftwareFoundation/ColorInterop), as
/// `get_color_interop_id()` finds it: eight floats (Rx, Ry, Gx, Gy, Bx,
/// By, Wx, Wy, CIE 1931 xy), or an empty span if they are unknown. The
/// span is valid until this ColorConfig is reset or destroyed.
/// By, Wx, Wy, CIE 1931 xy), or an empty span if they are unknown. A
/// color space of the config without such an ID, or whose ID OpenImageIO
/// has no primaries for, has them derived by analyzing its transforms,
/// unless the `colorconfig:analyze_transforms` attribute is 0. The span
/// is valid until this ColorConfig is reset or destroyed.
///
/// @version 3.2
OIIO_NODISCARD cspan<float> get_chromaticities(string_view colorspace) const;

/// Get the exponent of a color space's transfer function if it decodes
/// as a pure power, 1.0 if it is linear, or 0 if it is neither or is
/// unknown. Piecewise curves such as sRGB's report 0. Like
/// `get_chromaticities()`, it answers for a known Color Interop ID, and
/// it reports 1.0 for any color space whose config declares a linear
/// encoding.
/// unknown. Piecewise curves such as sRGB's report 0. A color space whose
/// config declares an encoding is linear only if that encoding is linear
/// for its reference type. Otherwise it answers for a known Color Interop
/// ID, or, like `get_chromaticities()`, by analyzing transforms.
///
/// @version 3.2
OIIO_NODISCARD float
Expand Down
8 changes: 8 additions & 0 deletions src/include/OpenImageIO/imageio.h
Original file line number Diff line number Diff line change
Expand Up @@ -4064,6 +4064,14 @@ OIIO_API std::string geterror(bool clear = true);
/// enable globally in an environment where security is a higher priority
/// than being tolerant of partially broken image files.
///
/// - `colorconfig:analyze_transforms` (int: 1)
///
/// If nonzero (the default), `ColorConfig::get_chromaticities()` and
/// `get_transfer_function_gamma()` may analyze the transforms of a color
/// space with no known Color Interop ID to derive its primaries and
/// whether it is linear. If zero, they answer only from what the config
/// declares and the names OpenImageIO knows.
///
/// - `ustring:cleanup` (int: 0)
///
/// If nonzero, upon exit, do a thorough (and possibly expensive) teardown
Expand Down
1 change: 1 addition & 0 deletions src/include/imageio_pvt.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ extern int limit_resolution;
extern int imagebuf_print_uncaught_errors;
extern int imagebuf_use_imagecache;
extern int imageinput_strict;
extern int colorconfig_analyze_transforms;
extern atomic_ll IB_local_mem_current;
extern atomic_ll IB_local_mem_peak;
extern std::atomic<float> IB_total_open_time;
Expand Down
5 changes: 3 additions & 2 deletions src/libOpenImageIO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ set (libOpenImageIO_srcs
imageinput.cpp imageio.cpp imageioplugin.cpp
imageoutput.cpp
iptc.cpp xmp.cpp
color_ocio.cpp
color_ocio.cpp color_derive.cpp
maketexture.cpp
bluenoise.cpp
printinfo.cpp
Expand Down Expand Up @@ -209,7 +209,8 @@ if (CMAKE_UNITY_BUILD)
# ${libOpenImageIO_srcs}
deepdata.cpp exif.cpp exif-canon.cpp formatspec.cpp imagebuf.cpp
imageinput.cpp imageio.cpp imageioplugin.cpp imageoutput.cpp
iptc.cpp xmp.cpp color_ocio.cpp maketexture.cpp bluenoise.cpp
iptc.cpp xmp.cpp color_ocio.cpp color_derive.cpp maketexture.cpp
bluenoise.cpp
PROPERTIES
UNITY_GROUP oiiolib)
foreach (plugin_dir ${all_format_plugin_dirs} ../libtexture)
Expand Down
Loading
Loading