Hello,
how can I remove the orange tint-mask from color-negatives with IM? I found one reference to gimp
http://www.freecolormanagement.com/colo ... nning.html which might give a hint. Probably one has to set the color of the tint-mask manually somewhere on the commandline - or is there maybe a sort of color-picker in IM?
Thanks, Bernhard
Removing orange tint-mask from color-negatives
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Removing orange tint-mask from color-negatives
The problem is that he does not say exactly what method was used to "merge" the levels. Also perhaps the images he has provided have lost some quality and do not quite represent his original. Anyway here is what I have done. I cropped his image from his page and called it moth.jpg
Then I measure its size:
identify moth.jpg
moth.jpg JPEG 255x386 255x386+0+0 8-bit DirectClass 26.7kb
Then I cropped the bottom 4 rows to get the color of the background:
convert moth.jpg[255x4+0+382] -scale 1x1! -format "%[pixel:s.p{0,0}]" info:
rgb(176,110,73)
His values were rgb(176,111,79). These are close to mine, but I used his.
Just for visualization, I created a swatch of that color:
convert -size 255x386 xc:"rgb(176,111,79)" moth_bgcolor.png
Now process the image by compositing with the color negated
convert moth.jpg \( -size 255x386 xc:"rgb(176,111,79)" -negate \) \
-compose plus -composite \
moth_tmp1.jpg
Alternately, you can do this and get the same result:
convert moth.jpg \( -size 255x386 xc:"rgb(176,111,79)" \) \
-compose minus -composite -negate \
moth_tmp1.jpg
Then equalize the result:
convert moth_tmp1.jpg -equalize moth_tmp1_equal.jpg
As I said, this is not as good as his result. I suspect his original image was different/better resolution. Furthermore, I don't know exactly how he merged them. He could have used some mixing ratio rather than an equal combination.
Then I measure its size:
identify moth.jpg
moth.jpg JPEG 255x386 255x386+0+0 8-bit DirectClass 26.7kb
Then I cropped the bottom 4 rows to get the color of the background:
convert moth.jpg[255x4+0+382] -scale 1x1! -format "%[pixel:s.p{0,0}]" info:
rgb(176,110,73)
His values were rgb(176,111,79). These are close to mine, but I used his.
Just for visualization, I created a swatch of that color:
convert -size 255x386 xc:"rgb(176,111,79)" moth_bgcolor.png
Now process the image by compositing with the color negated
convert moth.jpg \( -size 255x386 xc:"rgb(176,111,79)" -negate \) \
-compose plus -composite \
moth_tmp1.jpg
Alternately, you can do this and get the same result:
convert moth.jpg \( -size 255x386 xc:"rgb(176,111,79)" \) \
-compose minus -composite -negate \
moth_tmp1.jpg
Then equalize the result:
convert moth_tmp1.jpg -equalize moth_tmp1_equal.jpg
As I said, this is not as good as his result. I suspect his original image was different/better resolution. Furthermore, I don't know exactly how he merged them. He could have used some mixing ratio rather than an equal combination.
Re: Removing orange tint-mask from color-negatives
Thanks for the nice illustrated solution. I think I will write a little script which will automate all the steps.
Bernhard
Bernhard
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Removing orange tint-mask from color-negatives
Post a couple of real examples after you finish your script and let us know any improvements in the technique (like something other than just -equalize)
Re: Removing orange tint-mask from color-negatives
Here is an improvement, which gives almost identical results to the one on the website:
Alternatively, instead of -fill ... -colorize 100%, +level-colors "rgb(176,111,79)" also works.
I think that +level-colors could probably do the job alone, using something like this (note the extra comma):
which is close but not as good as the first convert-statement. The rgb-values are the difference to the tint-mask value of the red-channel (e.g. green: 176-111=65). I have tried different variations like using the difference to 256, but I did not succeed.
Bernhard
Code: Select all
convert /tmp/moth.jpg \( -clone 0 -fill "rgb(176,111,79)" -colorize 100% -negate \) -compose overlay -composite -negate -normalize x:
I think that +level-colors could probably do the job alone, using something like this (note the extra comma):
Code: Select all
convert /tmp/moth.jpg +level-colors "rgb(0,65,97)," -negate -normalize x:
which is close but not as good as the first convert-statement. The rgb-values are the difference to the tint-mask value of the red-channel (e.g. green: 176-111=65). I have tried different variations like using the difference to 256, but I did not succeed.
Bernhard
Re: Removing orange tint-mask from color-negatives
And finally, a very simple solution which does not need any information about the color-mask:
Credit: http://www.computer-darkroom.com/tutori ... al_6_1.htm. But with IM it is much simpler than with PS
This normalizes each channel seperatly, removing the blue color-cast after the first -negate. Depending on the result, it might also be necessary to add a "+channel -normalize" to do a final global normalization.
I think I will try these different solutions with a few real world scans of my color-negatives and then I will decide which is the better approach.
Bernhard
Code: Select all
convert /tmp/moth.jpg -negate -channel all -normalize x:
This normalizes each channel seperatly, removing the blue color-cast after the first -negate. Depending on the result, it might also be necessary to add a "+channel -normalize" to do a final global normalization.
I think I will try these different solutions with a few real world scans of my color-negatives and then I will decide which is the better approach.
Bernhard
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Removing orange tint-mask from color-negatives
Of course using -normalize is actually cheating, and will not work for ALL images.
What is really needed is the correct level adjustment for each image (linear), or histogram adjsutments (channel curves), or even a Hald CLUT (Any negate RGB to Photo RGB) for the negative type. I believe their are quite a number of negative types.
What is really needed is the correct level adjustment for each image (linear), or histogram adjsutments (channel curves), or even a Hald CLUT (Any negate RGB to Photo RGB) for the negative type. I believe their are quite a number of negative types.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/