Skip to content

Commit

Permalink
- Fixed DisplayCAL.ICCProfile.ICCProfile.get_info() method to pro…
Browse files Browse the repository at this point in the history
…perly convert the ``bytes`` value of the:

  - ``Colorant`` channels,
  - Display ``manufacturer`` and ``model`` codes,
  - ``EDID`` data as the ``metadata``,
  properly.
- Added more real world icc profiles (of my Dell UP2516D).
- Added test for issue eoyilmaz#50 which can't replicate the reported error (requested data from the user).
  • Loading branch information
eoyilmaz committed Mar 20, 2022
1 parent 1f179ef commit b3e1715
Show file tree
Hide file tree
Showing 9 changed files with 4,819 additions and 21 deletions.
41 changes: 20 additions & 21 deletions DisplayCAL/ICCProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7428,7 +7428,7 @@ def get_info(self):
if self.colorSpace.endswith(b"CLR"):
colorant_name = ""
else:
colorant_name = "(%s) " % self.colorSpace[i : i + 1]
colorant_name = "(%s) " % (self.colorSpace[i : i + 1]).decode("utf-8")
info[" Channel %i %sxy" % (i + 1, colorant_name)] = " ".join(
"%6.4f" % v for v in channel
)
Expand Down Expand Up @@ -7593,14 +7593,13 @@ def get_info(self):
)
elif isinstance(tag, MakeAndModelType):
info[name] = ""
manufacturer_code = tag.manufacturer
manufacturer_name = edid.get_manufacturer_name(edid.parse_manufacturer_id(manufacturer_code.ljust(2, b"\0")[:2]))
info[" Manufacturer"] = "0x%s %s" % (
binascii.hexlify(tag.manufacturer).upper(),
edid.get_manufacturer_name(
edid.parse_manufacturer_id(tag.manufacturer.ljust(2, b"\0")[:2])
)
or "",
binascii.hexlify(manufacturer_code).decode("utf-8").upper(),
manufacturer_name or "",
)
info[" Model"] = "0x%s" % binascii.hexlify(tag.model).upper()
info[" Model"] = "0x%s" % binascii.hexlify(tag.model).decode("utf-8").upper()
elif isinstance(tag, MeasurementType):
info[name] = ""
info[" Observer"] = tag.observer.description
Expand Down Expand Up @@ -7959,23 +7958,23 @@ def set_edid_metadata(self, edid):
# OpenICC keys (some shared with GCM)
self.tags.meta.update(
(
(b"prefix", ",".join(prefixes)),
(b"EDID_mnft", edid["manufacturer_id"]),
(b"EDID_mnft_id", struct.unpack(">H", edid["edid"][8:10])[0]),
(b"EDID_model_id", edid["product_id"]),
("prefix", ",".join(prefixes)),
("EDID_mnft", edid["manufacturer_id"]),
("EDID_mnft_id", struct.unpack(">H", edid["edid"][8:10])[0]),
("EDID_model_id", edid["product_id"]),
(
b"EDID_date",
b"%0.4i-T%i"
"EDID_date",
"%0.4i-T%i"
% (edid["year_of_manufacture"], edid["week_of_manufacture"]),
),
(b"EDID_red_x", edid["red_x"]),
(b"EDID_red_y", edid["red_y"]),
(b"EDID_green_x", edid["green_x"]),
(b"EDID_green_y", edid["green_y"]),
(b"EDID_blue_x", edid["blue_x"]),
(b"EDID_blue_y", edid["blue_y"]),
(b"EDID_white_x", edid["white_x"]),
(b"EDID_white_y", edid["white_y"]),
("EDID_red_x", edid["red_x"]),
("EDID_red_y", edid["red_y"]),
("EDID_green_x", edid["green_x"]),
("EDID_green_y", edid["green_y"]),
("EDID_blue_x", edid["blue_x"]),
("EDID_blue_y", edid["blue_y"]),
("EDID_white_x", edid["white_x"]),
("EDID_white_y", edid["white_y"]),
)
)
manufacturer = edid.get("manufacturer")
Expand Down
30 changes: 30 additions & 0 deletions tests/data/icc/Dell, DELL UP2516D (i1 Pro 2) 08.2020.ccss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
CCSS

DESCRIPTOR "Dell, DELL UP2516D (i1 Pro 2) 08.2020"
ORIGINATOR "Argyll ccxxmake"
CREATED "Wed Aug 05 09:00:59 2020"
REFERENCE "X-Rite i1 Pro 2"
REFERENCE_HASH "md5:7d3f4b8d298956c4fdea2095f787115a"
FIT_METHOD "ΔE*94"
MANUFACTURER_ID "DEL"
MANUFACTURER "Dell, Inc."
DISPLAY "DELL UP2516D"
TECHNOLOGY "LCD GB-R Phosphor IPS"
DISPLAY_TYPE_REFRESH "YES"
SPECTRAL_BANDS "109"
SPECTRAL_START_NM "370.000000"
SPECTRAL_END_NM "730.000000"
SPECTRAL_NORM "1.000000"

NUMBER_OF_FIELDS 110
BEGIN_DATA_FORMAT
SAMPLE_ID SPEC_370 SPEC_373 SPEC_377 SPEC_380 SPEC_383 SPEC_387 SPEC_390 SPEC_393 SPEC_397 SPEC_400 SPEC_403 SPEC_407 SPEC_410 SPEC_413 SPEC_417 SPEC_420 SPEC_423 SPEC_427 SPEC_430 SPEC_433 SPEC_437 SPEC_440 SPEC_443 SPEC_447 SPEC_450 SPEC_453 SPEC_457 SPEC_460 SPEC_463 SPEC_467 SPEC_470 SPEC_473 SPEC_477 SPEC_480 SPEC_483 SPEC_487 SPEC_490 SPEC_493 SPEC_497 SPEC_500 SPEC_503 SPEC_507 SPEC_510 SPEC_513 SPEC_517 SPEC_520 SPEC_523 SPEC_527 SPEC_530 SPEC_533 SPEC_537 SPEC_540 SPEC_543 SPEC_547 SPEC_550 SPEC_553 SPEC_557 SPEC_560 SPEC_563 SPEC_567 SPEC_570 SPEC_573 SPEC_577 SPEC_580 SPEC_583 SPEC_587 SPEC_590 SPEC_593 SPEC_597 SPEC_600 SPEC_603 SPEC_607 SPEC_610 SPEC_613 SPEC_617 SPEC_620 SPEC_623 SPEC_627 SPEC_630 SPEC_633 SPEC_637 SPEC_640 SPEC_643 SPEC_647 SPEC_650 SPEC_653 SPEC_657 SPEC_660 SPEC_663 SPEC_667 SPEC_670 SPEC_673 SPEC_677 SPEC_680 SPEC_683 SPEC_687 SPEC_690 SPEC_693 SPEC_697 SPEC_700 SPEC_703 SPEC_707 SPEC_710 SPEC_713 SPEC_717 SPEC_720 SPEC_723 SPEC_727 SPEC_730
END_DATA_FORMAT

NUMBER_OF_SETS 4
BEGIN_DATA
1 0.0909785 0.0622796 0.0537243 0.0248957 -0.00127127 0.0143468 0.0207964 0.0225788 0.0414286 0.0708555 0.0675070 0.0676534 0.130390 0.299803 0.662823 1.453389 2.937243 5.562421 10.21221 18.49384 32.62283 53.29287 76.01492 89.21166 84.32950 66.83441 49.37654 37.07732 27.84351 19.99475 13.92439 10.06032 7.876383 6.501361 5.520124 4.885060 4.747823 5.265101 6.498356 8.620065 12.10135 17.59007 25.63882 36.67633 50.12129 63.63202 73.99514 78.08338 75.03011 66.90506 56.94306 47.52142 39.62346 33.04576 27.34738 22.05597 17.28637 13.34681 10.25719 7.960215 6.320783 5.212807 4.510377 4.228324 4.384597 4.838450 5.676767 7.041290 8.960923 11.79837 17.47703 27.47207 38.86496 42.96999 38.76046 37.20486 48.89342 75.88953 100.0000 95.91028 68.69038 47.13193 41.60373 42.95603 41.31307 37.75096 35.53629 34.45528 33.64046 32.92191 32.14247 31.14228 29.90598 28.49585 27.13324 25.83824 24.58571 23.26653 21.69893 19.96730 18.12286 16.43274 15.03618 13.70971 12.59700 11.75993 11.09873 10.36263 9.551839
2 0.220615 0.159876 0.0824022 0.0335189 0.0103116 0.0247527 0.0605896 0.0615665 0.0523528 0.0492775 0.0236090 0.00941678 0.00529703 0.0000408841 0.00613382 0.0291819 0.0730291 0.0994954 0.160905 0.271500 0.403553 0.587928 0.773710 0.817176 0.674658 0.460549 0.312845 0.229371 0.204021 0.160400 0.134033 0.115786 0.0984868 0.0964340 0.108886 0.0925012 0.0877002 0.0945372 0.104922 0.130626 0.192316 0.274649 0.392665 0.585292 0.839303 1.044794 1.203577 1.256039 1.210255 1.036801 0.833248 0.655459 0.535115 0.434997 0.357533 0.285901 0.204848 0.149747 0.149098 0.163045 0.174613 0.281804 0.527808 0.923243 1.545721 2.392828 3.512129 5.079360 7.182491 10.17959 15.85365 25.65938 36.89045 41.14146 37.38882 36.26037 47.88317 74.42567 98.14636 94.19571 67.49380 46.34292 40.92974 42.28525 40.61245 37.04395 34.81034 33.64229 32.76786 32.04681 31.22559 30.17952 28.91002 27.52221 26.08557 24.71861 23.36404 21.87692 20.29703 18.67860 16.81866 15.13528 13.67124 12.40658 11.40755 10.62285 9.880523 9.106698 8.191411
3 -0.00942421 0.0467072 0.102924 0.101797 0.0221702 0.00300485 0.00893559 -0.0190665 0.0136548 0.0585199 0.0308077 0.0206160 0.0192702 0.0475654 0.0125348 0.0135759 0.0684183 0.109631 0.222699 0.409309 0.689658 1.101509 1.566016 1.838167 1.743497 1.397431 1.011361 0.761223 0.625370 0.543921 0.594035 0.873898 1.326310 1.783984 2.114737 2.385510 2.777813 3.499562 4.725825 6.699038 9.925695 15.03777 22.67498 33.32001 46.44921 59.80203 70.19440 74.58077 71.99277 64.40732 54.96340 45.96767 38.39541 32.08493 26.55631 21.45423 16.84360 12.99667 10.00121 7.750864 6.073470 4.845703 3.928891 3.240662 2.762893 2.410883 2.097583 1.873629 1.689833 1.513739 1.466653 1.560773 1.656375 1.468332 1.004816 0.675057 0.630991 0.770500 0.900405 0.780331 0.488852 0.287778 0.233422 0.223211 0.207943 0.224315 0.244841 0.262228 0.242724 0.280046 0.318042 0.321289 0.387174 0.469847 0.592944 0.650221 0.722760 0.846053 1.004928 1.029846 0.969456 0.956831 0.940456 0.908455 0.899440 0.920933 0.968814 1.035084 1.091880
4 0.0614600 0.0250214 0.0504477 0.0845965 0.0491220 0.0197160 0.0385447 0.0228168 0.0148597 0.0401937 0.0436301 0.0653519 0.101722 0.257273 0.601784 1.338690 2.760737 5.290017 9.752696 17.68566 31.24833 51.11632 72.98470 85.76590 81.20610 64.42594 47.63189 35.80941 26.83610 19.13890 13.06809 8.983771 6.386145 4.582600 3.257280 2.353035 1.865473 1.671462 1.657960 1.756376 1.961627 2.239278 2.500879 2.671439 2.701800 2.573385 2.303529 1.951467 1.579073 1.215010 0.916788 0.686537 0.502343 0.381073 0.279513 0.202474 0.155851 0.118911 0.0818782 0.0682205 0.0475238 0.0561071 0.0484995 0.0390977 0.0457014 0.00975169 0.000822591 0.0250203 0.0157503 0.0346358 0.0602756 0.0548462 0.0659624 0.0777180 0.0910700 0.103998 0.131953 0.152942 0.184222 0.187655 0.125231 0.100303 0.142181 0.180509 0.219663 0.246607 0.307875 0.340066 0.353748 0.352293 0.353495 0.355911 0.353901 0.360576 0.295822 0.268801 0.289144 0.307605 0.277235 0.272484 0.248764 0.241774 0.256962 0.187888 0.177841 0.211756 0.153153 0.190646 0.322234
END_DATA
Loading

0 comments on commit b3e1715

Please sign in to comment.