Script to Implement Red-Eye Removal Technique

Here's a script that helps remove red eye from flash photos, using the technique described in the February issue of LJ.

The latest issue of Linux Journal includes an article explaining how you can remove "red-eye" from flash photographs. Martin Guldahl, author of the Channel Mixer plugin, recently sent me a script that implements the technique in the article (see Listing 1). Put the script into your GIMP scripts directory (e.g., ~/.gimp-1.2/scripts/).

Listing 1. red-eye.scm

To use the script, simply select a few pixels in the red region of one pupil (i.e., draw a small outline with the rectangle selection tool), then run the script (RC/Script-Fu/Selection/Red Eye). Fill in the parameters, which correspond with the ones described above, and click OK. If the result is not satisfactory, click Undo (Ctrl+Z) and retry the script with different values. Repeat with the other pupil. A second script included in the file (Script-Fu/Selection/Red Eye Desaturate) uses the red channel desaturate technique, and thus does not require Channel Mixer if you don't have it installed.

Red-eye reduction may seem to be an involved process at first, but it actually takes only a couple of minutes once you have the hang of it or even less time if you use the script. Best of all, the results are excellent, especially when photos are printed on a high-resolution photo inkjet printer. Throw this technique into your bag of GIMP tricks, and you'll never have to worry about red-eye ruining your candid flash photos again.

Eric Jeschke holds a PhD in computer science from Indiana University and has worked as a software engineer, university professor and freelance consultant.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

red-eye.scm

Anonymous's picture

Superb, just worked. Saved me hours of messing.

Thanks

Nice

Anonymous's picture

I had good results when I followed the directions exactly. Many thanks Eric.

Lee

Oops

Lee's picture

I meant to thanks the script author Martin Guldahl. Thank you Martin Guldahl.
Lee

I tried to use this script fo

mar's picture

I tried to use this script for to remove red-eyes effect from my son's photo. The thing is that he is red-headed and now a bit sun-burned (so red color is all-over his face, not in the red eyes only). So the plugin (as well as the hand-technique) had mixed the colours all over the photo. The only way out I had found was to copy red eyes into new image, work with plugin over that new image and then copy them from new image into old one.
:)

Re: Script to Implement Red-Eye Removal Technique

Anonymous's picture

I use College Linux 2.5 (kernel 2.4.23) (should be 100% compatible with Slackware 9.1) and The Gimp v2.0pre3. When I use that function, I receive the following error messages:

Message 1
*********
WARNING: Plug-In "script-fu"
(/usr/lib/gimp/1.3/plug-ins/script-fu)

called deprecated procedure 'gimp_undo_push_group_start'.
It should call 'gimp_image_undo_group_start' instead!

Message 2
*********
WARNING: Plug-In "script-fu"
(/usr/lib/gimp/1.3/plug-ins/script-fu)

called deprecated procedure 'gimp_undo_push_group_end'.
It should call 'gimp_image_undo_group_end' instead!

I tried to manually correct it but then it stopped work at all, that red eye removal script and returned fatal error.

What can I do?

Re: Script to Implement Red-Eye Removal Technique

Anonymous's picture

any idea how can i implement that using VB.NET ??

:)

Tamir

Red eye correction

anu's picture

How to perform red eye correction in vb.net?

Re: Script to Implement Red-Eye Removal Technique

Anonymous's picture

I forgot to say, that it makes its work but reduces all image red color, doesn't matter, do I select region or not. It's not result what I expect. I used that old technique, that I zoom in that area, select it with lasso tool, then I turn green and blue color channel invisible and then I change the saturation of red color only. But then I get almost white eyes :( But playing with saturation I can get almost normal result. But this is workaround solution. Here is one articel - http://www.imaging-resource.com/NEWS/1019682730.html but this recourse is not available and it seems like it's not opensource software and freely redistributable :(

Re: Script to Implement Red-Eye Removal Technique

Anonymous's picture

I'm not sure what I'm doing wrong. I downloaded the sript, placed it in the directory, bring up an image with redeyes, zoom in on the redeyes, select the redeyes with the elliptical tool, and run the script, but I keep getting the following error message:

Script-Fu Error while executing
(script-fu-red-eye 6 34 8 40 10 60 30)
ERROR: Procedural database execution failed:
(gimp_image_set_component_active 6 0 0)

I am a newbie to Gimp - I'm running Gimp 1.3.18 on a Suse Linux box.

Thanks,

Re: Script to Implement Red-Eye Removal Technique

Anonymous's picture

I've got good news and bad news. The good news is that this plugin was recently ported to the gimp source tree - and I assume that it will be in the next development release. The bad news is that there is no such release yet, so for now, you have to use gimp-1.2 and download the plugin separately.

Re: Script to Implement Red-Eye Removal Technique

Anonymous's picture

has anyone tried this under windows? i have the latest windows version of gimp, and i downloaded the plugin pack for windows gimp (channel mixer seems to work fine). whenever i run this script, i get the error msg "too few arguments". anyone have any ideas?

thanks in advance!

Re: Script to Implement Red-Eye Removal Technique

Anonymous's picture

This is due to the version of color channel-mixer plugin you have which is older then the one you need. however i did not find yet a compiled color channel-mixer from the newer version.

rani

Re: Script to Implement Red-Eye Removal Technique

Anonymous's picture

Will this script work with Gimp 1.3.x such as 1.3.11?

Re: Script to Implement Red-Eye Removal Technique

Anonymous's picture

There is a slight typo in the script linked by the article.

The symptom is that the first menu command fails to register.

Near the end of the script where it registers both scripts, chage the first one:

(script-fu-register "script-fu-red-eye"

_"<mage>/Script-Fu/Selection/Red Eye..."

to

(script-fu-register "script-fu-red-eye"

_"<Image>/Script-Fu/Selection/Red Eye..."

ie change the "<mage>" to "<Image>"

it all works after that

Re: Script to Implement Red-Eye Removal Technique

Anonymous's picture

Will this technique work for other colors? I took a picture of my cat and it gave him glowing green eyes.

Re: Script to Implement Red-Eye Removal Technique

Anonymous's picture

Cat's have a reflective material in the back of their eyes, helps them see at night. Can't remember what it's called. Anyhow, couldn't you just run the same process on the Green channel?

Re: Script to Implement Red-Eye Removal Technique

Anonymous's picture

The name is tapetum lucidum.

Owned?

Anonymous's picture

Is the download site for the script supposed to be "owned"?

Re: Owned?

Anonymous's picture

it seems so... :-/