-complex with alpha
Posted: 2016-09-21T09:13:11-07:00
Version: v6.9.5-3, Q32 HDRI built with Cygwin, on Windows 8.1.
Complex arithmetic on the alpha channel is wrong.
For example, create four images:
Images r1 and r2 have transparency.
If we add them with ordinary (non-complex) arithmetic ...
... the resulting alpha is 0.5 + 0.1 = 0.600015. This is correct (or near enough).
But if we add them with complex arithmetic ...
... the resulting alpha is 0.5 + 0.1 = -0.399985. This is clearly wrong.
Similar problems occur with the other complex operators.
Complex arithmetic on the alpha channel is wrong.
For example, create four images:
Code: Select all
%IMDEV%convert xc:rgba(10%%,11%%,12%%,0.5) r1.png
%IMDEV%convert xc:rgba(10%%,11%%,12%%) i1.png
%IMDEV%convert xc:rgba(20%%,21%%,22%%,0.1) r2.png
%IMDEV%convert xc:rgba(20%%,21%%,22%%) i2.png
If we add them with ordinary (non-complex) arithmetic ...
Code: Select all
%IMDEV%convert ^
r1.png r2.png ^
-channel RGBA ^
-compose Plus -composite ^
+channel ^
txt:
Code: Select all
# ImageMagick pixel enumeration: 1,1,4294967295,srgba
0,0: (1.28852e+09,1.37438e+09,1.4603e+09,2.57705e+09) #4CCD51EB570A999A srgba(30.0008%,31.9997%,34.0002%,0.600015)
But if we add them with complex arithmetic ...
Code: Select all
%IMDEV%convert ^
r1.png i1.png r2.png i2.png ^
-complex Add ^
txt:
Code: Select all
# ImageMagick pixel enumeration: 1,1,4294967295,srgba
0,0: (1.28852e+09,1.37438e+09,1.4603e+09,-1.71792e+09) #4CCD4CCD51EB51EB570A570A00000000 srgba(30.0008%,31.9997%,34.0002%,-0.399985)
# ImageMagick pixel enumeration: 1,1,4294967295,srgba
0,0: (1.28852e+09,1.37438e+09,1.4603e+09,4.29497e+09) #4CCD51EB570AFFFF srgba(30.0008%,31.9997%,34.0002%,1)
Similar problems occur with the other complex operators.