I am not sure how you want to deal with composition between two grayscale images. I would think that if both were gamma=1(linear) then keep gamma=1 and if both are gamma=0.4545(nonlinear), keep gamma=0.4545. The mixed case is hard to say what is right. Should it 1) be promoted to non-linear always or 2) demoted to linear always or 3) depend upon the first image in the sequence? Thought for Magick and Anthony.
Input:
Seems that -compose colordodge -composite on two linear grayscale (gamma=1) images ends up with gamma=0.4545.
This issue may extend to other compose methods?
convert \( redhat.jpg -colorspace gray -format "1:%[colorspace],%[gamma]\n" -write info: \) \
\( -clone 0 -negate -blur 0x2 -format "2:%[colorspace],%[gamma]\n" -write info: \) \
-compose colordodge -composite -format "3:%[colorspace],%[gamma]\n" -write info: \
-evaluate pow 4 -threshold 90% -format "4:%[colorspace],%[gamma]\n" -write info: 1tmp1.png
Code: Select all
1:Gray,1
2:Gray,1
3:Gray,0.454545
4:Gray,0.454545
If I put in -set colorspace RGB, it fixes the issue above, but the subsequent image after -threshold ends up still with gamma=0.4545
convert \( redhat.jpg -colorspace gray -format "1:%[colorspace],%[gamma]\n" -write info: \) \
\( -clone 0 -negate -blur 0x2 -format "2:%[colorspace],%[gamma]\n" -write info: \) \
-compose colordodge -composite -set colorspace RGB -format "3:%[colorspace],%[gamma]\n" -write info: \
-evaluate pow 4 -threshold 90% -format "4:%[colorspace],%[gamma]\n" -write info: 1tmp1.png
Code: Select all
1:Gray,1
2:Gray,1
3:Gray,1
4:Gray,0.454545
If remove the -threshold, the result is finally gamma=1
convert \( redhat.jpg -colorspace gray -format "1:%[colorspace],%[gamma]\n" -write info: \) \
\( -clone 0 -negate -blur 0x2 -format "2:%[colorspace],%[gamma]\n" -write info: \) \
-compose colordodge -composite -set colorspace RGB -format "3:%[colorspace],%[gamma]\n" -write info: \
-evaluate pow 4 -format "4:%[colorspace],%[gamma]\n" -write info: 1tmp1.png
Code: Select all
1:Gray,1
2:Gray,1
3:Gray,1
4:Gray,1