Serenity Operating System
at master 438 lines 25 kB view raw
1/* 2 * Copyright (c) 2022-2023, Nico Weber <thakis@chromium.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <AK/String.h> 8#include <AK/StringView.h> 9#include <LibCore/ArgsParser.h> 10#include <LibCore/DateTime.h> 11#include <LibCore/File.h> 12#include <LibCore/MappedFile.h> 13#include <LibGfx/ICC/BinaryWriter.h> 14#include <LibGfx/ICC/Profile.h> 15#include <LibGfx/ICC/Tags.h> 16#include <LibGfx/ICC/WellKnownProfiles.h> 17#include <LibGfx/ImageDecoder.h> 18#include <LibVideo/Color/CodingIndependentCodePoints.h> 19 20template<class T> 21static ErrorOr<String> hyperlink(URL const& target, T const& label) 22{ 23 return String::formatted("\033]8;;{}\033\\{}\033]8;;\033\\", target, label); 24} 25 26template<class T> 27static void out_optional(char const* label, Optional<T> const& optional) 28{ 29 out("{}: ", label); 30 if (optional.has_value()) 31 outln("{}", *optional); 32 else 33 outln("(not set)"); 34} 35 36static void out_curve(Gfx::ICC::CurveTagData const& curve, int indent_amount) 37{ 38 auto indent = MUST(String::repeated(' ', indent_amount)); 39 if (curve.values().is_empty()) { 40 outln("{}identity curve", indent); 41 } else if (curve.values().size() == 1) { 42 outln("{}gamma: {}", indent, FixedPoint<8, u16>::create_raw(curve.values()[0])); 43 } else { 44 // FIXME: Maybe print the actual points if -v is passed? 45 outln("{}curve with {} points", indent, curve.values().size()); 46 } 47} 48 49static void out_parametric_curve(Gfx::ICC::ParametricCurveTagData const& parametric_curve, int indent_amount) 50{ 51 auto indent = MUST(String::repeated(' ', indent_amount)); 52 switch (parametric_curve.function_type()) { 53 case Gfx::ICC::ParametricCurveTagData::FunctionType::Type0: 54 outln("{}Y = X**{}", indent, parametric_curve.g()); 55 break; 56 case Gfx::ICC::ParametricCurveTagData::FunctionType::Type1: 57 outln("{}Y = ({}*X + {})**{} if X >= -{}/{}", indent, 58 parametric_curve.a(), parametric_curve.b(), parametric_curve.g(), parametric_curve.b(), parametric_curve.a()); 59 outln("{}Y = 0 else", indent); 60 break; 61 case Gfx::ICC::ParametricCurveTagData::FunctionType::Type2: 62 outln("{}Y = ({}*X + {})**{} + {} if X >= -{}/{}", indent, 63 parametric_curve.a(), parametric_curve.b(), parametric_curve.g(), parametric_curve.c(), parametric_curve.b(), parametric_curve.a()); 64 outln("{}Y = {} else", indent, parametric_curve.c()); 65 break; 66 case Gfx::ICC::ParametricCurveTagData::FunctionType::Type3: 67 outln("{}Y = ({}*X + {})**{} if X >= {}", indent, 68 parametric_curve.a(), parametric_curve.b(), parametric_curve.g(), parametric_curve.d()); 69 outln("{}Y = {}*X else", indent, parametric_curve.c()); 70 break; 71 case Gfx::ICC::ParametricCurveTagData::FunctionType::Type4: 72 outln("{}Y = ({}*X + {})**{} + {} if X >= {}", indent, 73 parametric_curve.a(), parametric_curve.b(), parametric_curve.g(), parametric_curve.e(), parametric_curve.d()); 74 outln("{}Y = {}*X + {} else", indent, parametric_curve.c(), parametric_curve.f()); 75 break; 76 } 77} 78 79static void out_curves(Vector<Gfx::ICC::LutCurveType> const& curves) 80{ 81 for (auto const& curve : curves) { 82 VERIFY(curve->type() == Gfx::ICC::CurveTagData::Type || curve->type() == Gfx::ICC::ParametricCurveTagData::Type); 83 outln(" type {}, relative offset {}, size {}", curve->type(), curve->offset(), curve->size()); 84 if (curve->type() == Gfx::ICC::CurveTagData::Type) 85 out_curve(static_cast<Gfx::ICC::CurveTagData&>(*curve), /*indent=*/12); 86 if (curve->type() == Gfx::ICC::ParametricCurveTagData::Type) 87 out_parametric_curve(static_cast<Gfx::ICC::ParametricCurveTagData&>(*curve), /*indent=*/12); 88 } 89} 90 91ErrorOr<int> serenity_main(Main::Arguments arguments) 92{ 93 Core::ArgsParser args_parser; 94 95 StringView path; 96 args_parser.add_positional_argument(path, "Path to ICC profile or to image containing ICC profile", "FILE", Core::ArgsParser::Required::No); 97 98 StringView name; 99 args_parser.add_option(name, "Name of a built-in profile, such as 'sRGB'", "name", 'n', "NAME"); 100 101 StringView dump_out_path; 102 args_parser.add_option(dump_out_path, "Dump unmodified ICC profile bytes to this path", "dump-to", 0, "FILE"); 103 104 StringView reencode_out_path; 105 args_parser.add_option(reencode_out_path, "Reencode ICC profile to this path", "reencode-to", 0, "FILE"); 106 107 bool force_print = false; 108 args_parser.add_option(force_print, "Print profile even when writing ICC files", "print", 0); 109 110 args_parser.parse(arguments); 111 112 if (path.is_empty() && name.is_empty()) { 113 warnln("need either a path or a profile name"); 114 return 1; 115 } 116 if (!path.is_empty() && !name.is_empty()) { 117 warnln("can't have both a path and a profile name"); 118 return 1; 119 } 120 if (path.is_empty() && !dump_out_path.is_empty()) { 121 warnln("--dump-to only valid with path, not with profile name; use --reencode-to instead"); 122 return 1; 123 } 124 125 ReadonlyBytes icc_bytes; 126 NonnullRefPtr<Gfx::ICC::Profile> profile = TRY([&]() -> ErrorOr<NonnullRefPtr<Gfx::ICC::Profile>> { 127 if (!name.is_empty()) { 128 if (name == "sRGB") 129 return Gfx::ICC::sRGB(); 130 return Error::from_string_literal("unknown profile name"); 131 } 132 auto file = TRY(Core::MappedFile::map(path)); 133 134 auto decoder = Gfx::ImageDecoder::try_create_for_raw_bytes(file->bytes()); 135 if (decoder) { 136 if (auto embedded_icc_bytes = TRY(decoder->icc_data()); embedded_icc_bytes.has_value()) { 137 icc_bytes = *embedded_icc_bytes; 138 } else { 139 outln("image contains no embedded ICC profile"); 140 exit(1); 141 } 142 } else { 143 icc_bytes = file->bytes(); 144 } 145 146 if (!dump_out_path.is_empty()) { 147 auto output_stream = TRY(Core::File::open(dump_out_path, Core::File::OpenMode::Write)); 148 TRY(output_stream->write_until_depleted(icc_bytes)); 149 } 150 return Gfx::ICC::Profile::try_load_from_externally_owned_memory(icc_bytes); 151 }()); 152 153 if (!reencode_out_path.is_empty()) { 154 auto reencoded_bytes = TRY(Gfx::ICC::encode(profile)); 155 auto output_stream = TRY(Core::File::open(reencode_out_path, Core::File::OpenMode::Write)); 156 TRY(output_stream->write_until_depleted(reencoded_bytes)); 157 } 158 159 bool do_print = (dump_out_path.is_empty() && reencode_out_path.is_empty()) || force_print; 160 if (!do_print) 161 return 0; 162 163 outln(" size: {} bytes", profile->on_disk_size()); 164 out_optional(" preferred CMM type", profile->preferred_cmm_type()); 165 outln(" version: {}", profile->version()); 166 outln(" device class: {}", Gfx::ICC::device_class_name(profile->device_class())); 167 outln(" data color space: {}", Gfx::ICC::data_color_space_name(profile->data_color_space())); 168 outln(" connection space: {}", Gfx::ICC::profile_connection_space_name(profile->connection_space())); 169 outln("creation date and time: {}", Core::DateTime::from_timestamp(profile->creation_timestamp())); 170 out_optional(" primary platform", profile->primary_platform().map([](auto platform) { return primary_platform_name(platform); })); 171 172 auto flags = profile->flags(); 173 outln(" flags: 0x{:08x}", flags.bits()); 174 outln(" - {}embedded in file", flags.is_embedded_in_file() ? "" : "not "); 175 outln(" - can{} be used independently of embedded color data", flags.can_be_used_independently_of_embedded_color_data() ? "" : "not"); 176 if (auto unknown_icc_bits = flags.icc_bits() & ~Gfx::ICC::Flags::KnownBitsMask) 177 outln(" other unknown ICC bits: 0x{:04x}", unknown_icc_bits); 178 if (auto color_management_module_bits = flags.color_management_module_bits()) 179 outln(" CMM bits: 0x{:04x}", color_management_module_bits); 180 181 out_optional(" device manufacturer", TRY(profile->device_manufacturer().map([](auto device_manufacturer) { 182 return hyperlink(device_manufacturer_url(device_manufacturer), device_manufacturer); 183 }))); 184 out_optional(" device model", TRY(profile->device_model().map([](auto device_model) { 185 return hyperlink(device_model_url(device_model), device_model); 186 }))); 187 188 auto device_attributes = profile->device_attributes(); 189 outln(" device attributes: 0x{:016x}", device_attributes.bits()); 190 outln(" media is:"); 191 outln(" - {}", 192 device_attributes.media_reflectivity() == Gfx::ICC::DeviceAttributes::MediaReflectivity::Reflective ? "reflective" : "transparent"); 193 outln(" - {}", 194 device_attributes.media_glossiness() == Gfx::ICC::DeviceAttributes::MediaGlossiness::Glossy ? "glossy" : "matte"); 195 outln(" - {}", 196 device_attributes.media_polarity() == Gfx::ICC::DeviceAttributes::MediaPolarity::Positive ? "of positive polarity" : "of negative polarity"); 197 outln(" - {}", 198 device_attributes.media_color() == Gfx::ICC::DeviceAttributes::MediaColor::Colored ? "colored" : "black and white"); 199 VERIFY((flags.icc_bits() & ~Gfx::ICC::DeviceAttributes::KnownBitsMask) == 0); 200 if (auto vendor_bits = device_attributes.vendor_bits()) 201 outln(" vendor bits: 0x{:08x}", vendor_bits); 202 203 outln(" rendering intent: {}", Gfx::ICC::rendering_intent_name(profile->rendering_intent())); 204 outln(" pcs illuminant: {}", profile->pcs_illuminant()); 205 out_optional(" creator", profile->creator()); 206 out_optional(" id", profile->id()); 207 208 size_t profile_disk_size = icc_bytes.size(); 209 if (profile_disk_size != profile->on_disk_size()) { 210 VERIFY(profile_disk_size > profile->on_disk_size()); 211 outln("{} trailing bytes after profile data", profile_disk_size - profile->on_disk_size()); 212 } 213 214 outln(""); 215 216 outln("tags:"); 217 HashMap<Gfx::ICC::TagData*, Gfx::ICC::TagSignature> tag_data_to_first_signature; 218 TRY(profile->try_for_each_tag([&tag_data_to_first_signature](auto tag_signature, auto tag_data) -> ErrorOr<void> { 219 if (auto name = tag_signature_spec_name(tag_signature); name.has_value()) 220 out("{} ({}): ", *name, tag_signature); 221 else 222 out("Unknown tag ({}): ", tag_signature); 223 outln("type {}, offset {}, size {}", tag_data->type(), tag_data->offset(), tag_data->size()); 224 225 // Print tag data only the first time it's seen. 226 // (Different sigatures can refer to the same data.) 227 auto it = tag_data_to_first_signature.find(tag_data); 228 if (it != tag_data_to_first_signature.end()) { 229 outln(" (see {} above)", it->value); 230 return {}; 231 } 232 tag_data_to_first_signature.set(tag_data, tag_signature); 233 234 if (tag_data->type() == Gfx::ICC::ChromaticityTagData::Type) { 235 auto& chromaticity = static_cast<Gfx::ICC::ChromaticityTagData&>(*tag_data); 236 outln(" phosphor or colorant type: {}", Gfx::ICC::ChromaticityTagData::phosphor_or_colorant_type_name(chromaticity.phosphor_or_colorant_type())); 237 for (auto const& xy : chromaticity.xy_coordinates()) 238 outln(" x, y: {}, {}", xy.x, xy.y); 239 } else if (tag_data->type() == Gfx::ICC::CicpTagData::Type) { 240 auto& cicp = static_cast<Gfx::ICC::CicpTagData&>(*tag_data); 241 outln(" color primaries: {} - {}", cicp.color_primaries(), 242 Video::color_primaries_to_string((Video::ColorPrimaries)cicp.color_primaries())); 243 outln(" transfer characteristics: {} - {}", cicp.transfer_characteristics(), 244 Video::transfer_characteristics_to_string((Video::TransferCharacteristics)cicp.transfer_characteristics())); 245 outln(" matrix coefficients: {} - {}", cicp.matrix_coefficients(), 246 Video::matrix_coefficients_to_string((Video::MatrixCoefficients)cicp.matrix_coefficients())); 247 outln(" video full range flag: {} - {}", cicp.video_full_range_flag(), 248 Video::video_full_range_flag_to_string((Video::VideoFullRangeFlag)cicp.video_full_range_flag())); 249 } else if (tag_data->type() == Gfx::ICC::CurveTagData::Type) { 250 out_curve(static_cast<Gfx::ICC::CurveTagData&>(*tag_data), /*indent=*/4); 251 } else if (tag_data->type() == Gfx::ICC::Lut16TagData::Type) { 252 auto& lut16 = static_cast<Gfx::ICC::Lut16TagData&>(*tag_data); 253 outln(" input table: {} channels x {} entries", lut16.number_of_input_channels(), lut16.number_of_input_table_entries()); 254 outln(" output table: {} channels x {} entries", lut16.number_of_output_channels(), lut16.number_of_output_table_entries()); 255 outln(" color lookup table: {} grid points, {} total entries", lut16.number_of_clut_grid_points(), lut16.clut_values().size()); 256 257 auto const& e = lut16.e_matrix(); 258 outln(" e = [ {}, {}, {},", e[0], e[1], e[2]); 259 outln(" {}, {}, {},", e[3], e[4], e[5]); 260 outln(" {}, {}, {} ]", e[6], e[7], e[8]); 261 } else if (tag_data->type() == Gfx::ICC::Lut8TagData::Type) { 262 auto& lut8 = static_cast<Gfx::ICC::Lut8TagData&>(*tag_data); 263 outln(" input table: {} channels x {} entries", lut8.number_of_input_channels(), lut8.number_of_input_table_entries()); 264 outln(" output table: {} channels x {} entries", lut8.number_of_output_channels(), lut8.number_of_output_table_entries()); 265 outln(" color lookup table: {} grid points, {} total entries", lut8.number_of_clut_grid_points(), lut8.clut_values().size()); 266 267 auto const& e = lut8.e_matrix(); 268 outln(" e = [ {}, {}, {},", e[0], e[1], e[2]); 269 outln(" {}, {}, {},", e[3], e[4], e[5]); 270 outln(" {}, {}, {} ]", e[6], e[7], e[8]); 271 } else if (tag_data->type() == Gfx::ICC::LutAToBTagData::Type) { 272 auto& a_to_b = static_cast<Gfx::ICC::LutAToBTagData&>(*tag_data); 273 outln(" {} input channels, {} output channels", a_to_b.number_of_input_channels(), a_to_b.number_of_output_channels()); 274 275 if (auto const& optional_a_curves = a_to_b.a_curves(); optional_a_curves.has_value()) { 276 outln(" a curves: {} curves", optional_a_curves->size()); 277 out_curves(optional_a_curves.value()); 278 } else { 279 outln(" a curves: (not set)"); 280 } 281 282 if (auto const& optional_clut = a_to_b.clut(); optional_clut.has_value()) { 283 auto const& clut = optional_clut.value(); 284 outln(" color lookup table: {} grid points, {}", 285 TRY(String::join(" x "sv, clut.number_of_grid_points_in_dimension)), 286 TRY(clut.values.visit( 287 [](Vector<u8> const& v) { return String::formatted("{} u8 entries", v.size()); }, 288 [](Vector<u16> const& v) { return String::formatted("{} u16 entries", v.size()); }))); 289 } else { 290 outln(" color lookup table: (not set)"); 291 } 292 293 if (auto const& optional_m_curves = a_to_b.m_curves(); optional_m_curves.has_value()) { 294 outln(" m curves: {} curves", optional_m_curves->size()); 295 out_curves(optional_m_curves.value()); 296 } else { 297 outln(" m curves: (not set)"); 298 } 299 300 if (auto const& optional_e = a_to_b.e_matrix(); optional_e.has_value()) { 301 auto const& e = optional_e.value(); 302 outln(" e = [ {}, {}, {}, {},", e[0], e[1], e[2], e[9]); 303 outln(" {}, {}, {}, {},", e[3], e[4], e[5], e[10]); 304 outln(" {}, {}, {}, {} ]", e[6], e[7], e[8], e[11]); 305 } else { 306 outln(" e = (not set)"); 307 } 308 309 outln(" b curves: {} curves", a_to_b.b_curves().size()); 310 out_curves(a_to_b.b_curves()); 311 } else if (tag_data->type() == Gfx::ICC::LutBToATagData::Type) { 312 auto& b_to_a = static_cast<Gfx::ICC::LutBToATagData&>(*tag_data); 313 outln(" {} input channels, {} output channels", b_to_a.number_of_input_channels(), b_to_a.number_of_output_channels()); 314 315 outln(" b curves: {} curves", b_to_a.b_curves().size()); 316 out_curves(b_to_a.b_curves()); 317 318 if (auto const& optional_e = b_to_a.e_matrix(); optional_e.has_value()) { 319 auto const& e = optional_e.value(); 320 outln(" e = [ {}, {}, {}, {},", e[0], e[1], e[2], e[9]); 321 outln(" {}, {}, {}, {},", e[3], e[4], e[5], e[10]); 322 outln(" {}, {}, {}, {} ]", e[6], e[7], e[8], e[11]); 323 } else { 324 outln(" e = (not set)"); 325 } 326 327 if (auto const& optional_m_curves = b_to_a.m_curves(); optional_m_curves.has_value()) { 328 outln(" m curves: {} curves", optional_m_curves->size()); 329 out_curves(optional_m_curves.value()); 330 } else { 331 outln(" m curves: (not set)"); 332 } 333 334 if (auto const& optional_clut = b_to_a.clut(); optional_clut.has_value()) { 335 auto const& clut = optional_clut.value(); 336 outln(" color lookup table: {} grid points, {}", 337 TRY(String::join(" x "sv, clut.number_of_grid_points_in_dimension)), 338 TRY(clut.values.visit( 339 [](Vector<u8> const& v) { return String::formatted("{} u8 entries", v.size()); }, 340 [](Vector<u16> const& v) { return String::formatted("{} u16 entries", v.size()); }))); 341 } else { 342 outln(" color lookup table: (not set)"); 343 } 344 345 if (auto const& optional_a_curves = b_to_a.a_curves(); optional_a_curves.has_value()) { 346 outln(" a curves: {} curves", optional_a_curves->size()); 347 out_curves(optional_a_curves.value()); 348 } else { 349 outln(" a curves: (not set)"); 350 } 351 } else if (tag_data->type() == Gfx::ICC::MeasurementTagData::Type) { 352 auto& measurement = static_cast<Gfx::ICC::MeasurementTagData&>(*tag_data); 353 outln(" standard observer: {}", Gfx::ICC::MeasurementTagData::standard_observer_name(measurement.standard_observer())); 354 outln(" tristimulus value for measurement backing: {}", measurement.tristimulus_value_for_measurement_backing()); 355 outln(" measurement geometry: {}", Gfx::ICC::MeasurementTagData::measurement_geometry_name(measurement.measurement_geometry())); 356 outln(" measurement flare: {} %", measurement.measurement_flare() * 100); 357 outln(" standard illuminant: {}", Gfx::ICC::MeasurementTagData::standard_illuminant_name(measurement.standard_illuminant())); 358 } else if (tag_data->type() == Gfx::ICC::MultiLocalizedUnicodeTagData::Type) { 359 auto& multi_localized_unicode = static_cast<Gfx::ICC::MultiLocalizedUnicodeTagData&>(*tag_data); 360 for (auto& record : multi_localized_unicode.records()) { 361 outln(" {:c}{:c}/{:c}{:c}: \"{}\"", 362 record.iso_639_1_language_code >> 8, record.iso_639_1_language_code & 0xff, 363 record.iso_3166_1_country_code >> 8, record.iso_3166_1_country_code & 0xff, 364 record.text); 365 } 366 } else if (tag_data->type() == Gfx::ICC::NamedColor2TagData::Type) { 367 auto& named_colors = static_cast<Gfx::ICC::NamedColor2TagData&>(*tag_data); 368 outln(" vendor specific flag: 0x{:08x}", named_colors.vendor_specific_flag()); 369 outln(" common name prefix: \"{}\"", named_colors.prefix()); 370 outln(" common name suffix: \"{}\"", named_colors.suffix()); 371 outln(" {} colors:", named_colors.size()); 372 for (size_t i = 0; i < min(named_colors.size(), 5u); ++i) { 373 const auto& pcs = named_colors.pcs_coordinates(i); 374 375 // FIXME: Display decoded values? (See ICC v4 6.3.4.2 and 10.8.) 376 out(" \"{}\", PCS coordinates: 0x{:04x} 0x{:04x} 0x{:04x}", TRY(named_colors.color_name(i)), pcs.xyz.x, pcs.xyz.y, pcs.xyz.z); 377 if (auto number_of_device_coordinates = named_colors.number_of_device_coordinates(); number_of_device_coordinates > 0) { 378 out(", device coordinates:"); 379 for (size_t j = 0; j < number_of_device_coordinates; ++j) 380 out(" 0x{:04x}", named_colors.device_coordinates(i)[j]); 381 } 382 outln(); 383 } 384 if (named_colors.size() > 5u) 385 outln(" ..."); 386 } else if (tag_data->type() == Gfx::ICC::ParametricCurveTagData::Type) { 387 out_parametric_curve(static_cast<Gfx::ICC::ParametricCurveTagData&>(*tag_data), /*indent=*/4); 388 } else if (tag_data->type() == Gfx::ICC::S15Fixed16ArrayTagData::Type) { 389 // This tag can contain arbitrarily many fixed-point numbers, but in practice it's 390 // exclusively used for the 'chad' tag, where it always contains 9 values that 391 // represent a 3x3 matrix. So print the values in groups of 3. 392 auto& fixed_array = static_cast<Gfx::ICC::S15Fixed16ArrayTagData&>(*tag_data); 393 out(" ["); 394 int i = 0; 395 for (auto value : fixed_array.values()) { 396 if (i > 0) { 397 out(","); 398 if (i % 3 == 0) { 399 outln(); 400 out(" "); 401 } 402 } 403 out(" {}", value); 404 i++; 405 } 406 outln(" ]"); 407 } else if (tag_data->type() == Gfx::ICC::SignatureTagData::Type) { 408 auto& signature = static_cast<Gfx::ICC::SignatureTagData&>(*tag_data); 409 410 if (auto name = signature.name_for_tag(tag_signature); name.has_value()) { 411 outln(" signature: {}", name.value()); 412 } else { 413 outln(" signature: Unknown ('{:c}{:c}{:c}{:c}' / 0x{:08x})", 414 signature.signature() >> 24, (signature.signature() >> 16) & 0xff, (signature.signature() >> 8) & 0xff, signature.signature() & 0xff, 415 signature.signature()); 416 } 417 } else if (tag_data->type() == Gfx::ICC::TextDescriptionTagData::Type) { 418 auto& text_description = static_cast<Gfx::ICC::TextDescriptionTagData&>(*tag_data); 419 outln(" ascii: \"{}\"", text_description.ascii_description()); 420 out_optional(" unicode", TRY(text_description.unicode_description().map([](auto description) { return String::formatted("\"{}\"", description); }))); 421 outln(" unicode language code: 0x{}", text_description.unicode_language_code()); 422 out_optional(" macintosh", TRY(text_description.macintosh_description().map([](auto description) { return String::formatted("\"{}\"", description); }))); 423 } else if (tag_data->type() == Gfx::ICC::TextTagData::Type) { 424 outln(" text: \"{}\"", static_cast<Gfx::ICC::TextTagData&>(*tag_data).text()); 425 } else if (tag_data->type() == Gfx::ICC::ViewingConditionsTagData::Type) { 426 auto& viewing_conditions = static_cast<Gfx::ICC::ViewingConditionsTagData&>(*tag_data); 427 outln(" unnormalized CIEXYZ values for illuminant (in which Y is in cd/m²): {}", viewing_conditions.unnormalized_ciexyz_values_for_illuminant()); 428 outln(" unnormalized CIEXYZ values for surround (in which Y is in cd/m²): {}", viewing_conditions.unnormalized_ciexyz_values_for_surround()); 429 outln(" illuminant type: {}", Gfx::ICC::MeasurementTagData::standard_illuminant_name(viewing_conditions.illuminant_type())); 430 } else if (tag_data->type() == Gfx::ICC::XYZTagData::Type) { 431 for (auto& xyz : static_cast<Gfx::ICC::XYZTagData&>(*tag_data).xyzs()) 432 outln(" {}", xyz); 433 } 434 return {}; 435 })); 436 437 return 0; 438}