Skip to content

Commit fa2d288

Browse files
committed
Add another test of alpha handling from Brecht
Signed-off-by: Larry Gritz <[email protected]>
1 parent f154afe commit fa2d288

File tree

4 files changed

+79
-1
lines changed

4 files changed

+79
-1
lines changed

testsuite/png/ref/out-libpng15.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ exif.png : 64 x 64, 3 channel, uint8 png
2727
SHA-1: 7CB41FEA50720B48BE0C145E1473982B23E9AB77
2828
channel list: R, G, B
2929
oiio:ColorSpace: "sRGB"
30+
alphagamma:
3031
1 x 1, 4 channel, float png
3132
channel list: R, G, B, A
3233
ResolutionUnit: "inch"
@@ -46,6 +47,43 @@ exif.png : 64 x 64, 3 channel, uint8 png
4647
Constant: Yes
4748
Constant Color: 186.00 186.00 186.00 127.00 (of 255)
4849
Monochrome: No
50+
gimp_gradient:
51+
256 x 256, 4 channel, float png
52+
channel list: R, G, B, A
53+
Comment: "Created with GIMP"
54+
DateTime: "2025:01:05 04:44:59"
55+
ICCProfile: 0, 0, 2, 160, 108, 99, 109, 115, 4, 64, 0, 0, 109, 110, 116, 114, ... [672 x uint8]
56+
ResolutionUnit: "inch"
57+
XResolution: 300
58+
YResolution: 300
59+
ICCProfile:attributes: "Reflective, Glossy, Positive, Color"
60+
ICCProfile:cmm_type: 1818455411
61+
ICCProfile:color_space: "RGB"
62+
ICCProfile:copyright: "Public Domain"
63+
ICCProfile:creation_date: "2025:01:05 04:34:16"
64+
ICCProfile:creator_signature: "6c636d73"
65+
ICCProfile:device_class: "Display device profile"
66+
ICCProfile:device_manufacturer_description: "GIMP"
67+
ICCProfile:device_model_description: "sRGB"
68+
ICCProfile:flags: "Not Embedded, Independent"
69+
ICCProfile:manufacturer: "0"
70+
ICCProfile:model: "0"
71+
ICCProfile:platform_signature: "Apple Computer, Inc."
72+
ICCProfile:profile_connection_space: "XYZ"
73+
ICCProfile:profile_description: "GIMP built-in sRGB"
74+
ICCProfile:profile_size: 672
75+
ICCProfile:profile_version: "4.4.0"
76+
ICCProfile:rendering_intent: "Perceptual"
77+
oiio:ColorSpace: "sRGB"
78+
Stats Min: 0 0 0 0 (of 255)
79+
Stats Max: 255 255 0 255 (of 255)
80+
Stats Avg: 142.37 105.72 0.00 154.72 (of 255)
81+
Stats StdDev: 79.19 98.91 0.00 87.39 (of 255)
82+
Stats NanCount: 0 0 0 0
83+
Stats InfCount: 0 0 0 0
84+
Stats FiniteCount: 65536 65536 65536 65536
85+
Constant: No
86+
Monochrome: No
4987
smallalpha.png : 1 x 1, 4 channel, uint8 png
5088
Pixel (0, 0): 240 108 119 1 (0.94117653 0.42352945 0.4666667 0.003921569)
5189
Comparing "test16.png" and "ref/test16.png"

testsuite/png/ref/out.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ exif.png : 64 x 64, 3 channel, uint8 png
3131
Exif:FocalLength: 45.7 (45.7 mm)
3232
Exif:WhiteBalance: 0 (auto)
3333
oiio:ColorSpace: "sRGB"
34+
alphagamma:
3435
1 x 1, 4 channel, float png
3536
channel list: R, G, B, A
3637
ResolutionUnit: "inch"
@@ -50,6 +51,43 @@ exif.png : 64 x 64, 3 channel, uint8 png
5051
Constant: Yes
5152
Constant Color: 186.00 186.00 186.00 127.00 (of 255)
5253
Monochrome: No
54+
gimp_gradient:
55+
256 x 256, 4 channel, float png
56+
channel list: R, G, B, A
57+
Comment: "Created with GIMP"
58+
DateTime: "2025:01:05 04:44:59"
59+
ICCProfile: 0, 0, 2, 160, 108, 99, 109, 115, 4, 64, 0, 0, 109, 110, 116, 114, ... [672 x uint8]
60+
ResolutionUnit: "inch"
61+
XResolution: 300
62+
YResolution: 300
63+
ICCProfile:attributes: "Reflective, Glossy, Positive, Color"
64+
ICCProfile:cmm_type: 1818455411
65+
ICCProfile:color_space: "RGB"
66+
ICCProfile:copyright: "Public Domain"
67+
ICCProfile:creation_date: "2025:01:05 04:34:16"
68+
ICCProfile:creator_signature: "6c636d73"
69+
ICCProfile:device_class: "Display device profile"
70+
ICCProfile:device_manufacturer_description: "GIMP"
71+
ICCProfile:device_model_description: "sRGB"
72+
ICCProfile:flags: "Not Embedded, Independent"
73+
ICCProfile:manufacturer: "0"
74+
ICCProfile:model: "0"
75+
ICCProfile:platform_signature: "Apple Computer, Inc."
76+
ICCProfile:profile_connection_space: "XYZ"
77+
ICCProfile:profile_description: "GIMP built-in sRGB"
78+
ICCProfile:profile_size: 672
79+
ICCProfile:profile_version: "4.4.0"
80+
ICCProfile:rendering_intent: "Perceptual"
81+
oiio:ColorSpace: "sRGB"
82+
Stats Min: 0 0 0 0 (of 255)
83+
Stats Max: 255 255 0 255 (of 255)
84+
Stats Avg: 142.37 105.72 0.00 154.72 (of 255)
85+
Stats StdDev: 79.19 98.91 0.00 87.39 (of 255)
86+
Stats NanCount: 0 0 0 0
87+
Stats InfCount: 0 0 0 0
88+
Stats FiniteCount: 65536 65536 65536 65536
89+
Constant: No
90+
Monochrome: No
5391
smallalpha.png : 1 x 1, 4 channel, uint8 png
5492
Pixel (0, 0): 240 108 119 1 (0.94117653 0.42352945 0.4666667 0.003921569)
5593
Comparing "test16.png" and "ref/test16.png"

testsuite/png/run.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
command += oiiotool ("--pattern fill:topleft=1,0,0,1:topright=0,1,0,1:bottomleft=0,0,1,1:bottomright=1,1,1,1 16x16 4 -d uint16 -o test16.png")
2323

2424
# regression test for wrong gamma correction for partial alpha
25-
command += oiiotool ("--oiioattrib png:linear_premult 1 " +
25+
command += oiiotool ("-echo 'alphagamma:' " +
26+
"--oiioattrib png:linear_premult 1 " +
2627
"src/alphagamma.png --printinfo:stats=1")
28+
command += oiiotool ("-echo 'gimp_gradient:' src/gimp_gradient.png --printinfo:stats=1")
2729

2830
# Test high quality alpha deassociation using alpha value close to zero.
2931
# This example is inspired by Yafes on the Slack.
24.1 KB
Loading

0 commit comments

Comments
 (0)