You are here

Need help to compose RGB picture

I would like some help to write a script to compose a RGB picture from 3 different images (red, green and blue).
Here's what I'm doing step by step:
- Open in the same gimp workspace the 3 images
Then one by one
- Convert image to the RGB colorspace (instead of indexed colors)
- Decompose the picture
Now, I got 9 layers (3x3 RGB channels)
- Compose (from one of the new decomposed picture) a single RGB picture, selecting for each channel the one assiociated to the right picture (red channel from red picture...)
- Save the new RGB picture into TIF

Like I have to process hundreds of pictures, a script would be really helpful! But unfortunately I'm a complete newbie, so could you help me to write such a script ?

1. Use "File->Open As Layer(s)" to open your three indexed-mode files.
2. Convert with "Image->Mode->Grayscale".
3. Perform "Colors->Components->Compose" and choose the appropriate red, green, and blue layers (see dialog screenshot below).

A script could be written to automate this but only if there is some way to determine from the filename what channel each file is to be associated with.

Thanks a lot! That's much more simple now.
You're right, the tricky part for the script would be the selection of the right layer according to filename. Actually my pictures are named like this "..._Mg.tif" (=Red), "..._Ca.tif" (=Green) and "..._Al.tif" (=Blue).
Maybe next time, for the moment that should be enough.

Given the names of your files, the channels are probably loaded (As Layers) in the order blue, green, red from top to bottom. If this is the case, you can switch the layerstack to the order red, blue, green (top to bottom) using "Layer->Stack->Reverse Layer Order" and then they will appear in the proper order in the Compose dialog. (This is just a little bit easier than swapping the channels in the dialog.)

Subscribe to Comments for "Need help to compose RGB picture"