Removing orange tint-mask from color-negatives

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
bablokb
Posts: 29
Joined: 2005-06-11T06:21:59-07:00

Removing orange tint-mask from color-negatives

Post by bablokb »

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
User avatar
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 by fmw42 »

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

Image

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
Image

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
Image

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
Image


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.
bablokb
Posts: 29
Joined: 2005-06-11T06:21:59-07:00

Re: Removing orange tint-mask from color-negatives

Post by bablokb »

Thanks for the nice illustrated solution. I think I will write a little script which will automate all the steps.

Bernhard
User avatar
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 by fmw42 »

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)
bablokb
Posts: 29
Joined: 2005-06-11T06:21:59-07:00

Re: Removing orange tint-mask from color-negatives

Post by bablokb »

Here is an improvement, which gives almost identical results to the one on the website:

Code: Select all

convert /tmp/moth.jpg \( -clone 0 -fill "rgb(176,111,79)" -colorize 100% -negate \) -compose overlay -composite -negate -normalize x:
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):

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
bablokb
Posts: 29
Joined: 2005-06-11T06:21:59-07:00

Re: Removing orange tint-mask from color-negatives

Post by bablokb »

And finally, a very simple solution which does not need any information about the color-mask:

Code: Select all

convert /tmp/moth.jpg -negate -channel all -normalize x:
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
User avatar
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

Post by anthony »

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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply