PDA

View Full Version : HELP Please! Need to Create Thousands of RGB Merges




neocell
Nov 24, 2005, 08:23 PM
Hi, I hope someone here can help me with this. Here's the scoop. I have a bunch of images that are separated into red, green and blue and I need to merge them back into one (from 3 to 1, 1 red, 1 green, 1 blue into 1 pretty RGB image). So I have hundreds of merged images to make. Right now I have all the files named red1, red2, red3..., green1, green2..., blue1, blue2... etc. I'm using software running on Window's 2000 to do the merging though I was hoping that someone could tell me how I can automate this on my Mac so I don't have sit there clicking which file to open again and again and again. I was hoping that I could use automator and photoshop so that I can just run one script and have it search a specific folder and then merge all the appropriate red, green and blue files (folders have anywhere from 150, to 450 images) without any user input, and then save the merged files with an appropriately named title (ie. merged 1 up to merged x in folder whatever). Please let me know if this is possible. Thanks a lot

Don't know if this is the right forum. Mods please move it to most appropriate one. Thanks



HiRez
Nov 25, 2005, 10:34 PM
Please let me know if this is possible.I don't know of any Automator or Photoshop actions that will do this, but just out of curiosity, what format are your original images in, and what format are you trying to get the merged images into (.tif, etc.)? Is each of the single-color originals a single-plane grayscale image?

Mr. Anderson
Nov 25, 2005, 10:40 PM
Depending on the format, it almost sounds like you'd need to create an app specifically to do what you want. I remember way back in the day working with some satellite imagery and having to do the same thing - but I was working on a Sun Workstation and wrote a small program in C to read in the files and output the combined image.

D

kainjow
Nov 26, 2005, 10:59 AM
Depending on the format, it almost sounds like you'd need to create an app specifically to do what you want. I remember way back in the day working with some satellite imagery and having to do the same thing - but I was working on a Sun Workstation and wrote a small program in C to read in the files and output the combined image.

D
That's what I'm thinking. It looks way too specific for any currently existing program to do.

lexfuzo
Nov 26, 2005, 11:21 AM
That's what I'm thinking. It looks way too specific for any currently existing program to do.

nonono, ImageMagick does the trick!
Grab your copy from http://www.imagemagick.org/ and issue the following command (one line):

convert red1.tif green1.tif blue1.tif -channel RGB -combine combined.tif

(works with almost any other format as well, not just .tif.)
Wrap some shell script around it to batch process your files.

neocell
Nov 26, 2005, 02:41 PM
Thanks a lot, every one for getting back. They're all tiff files and I have no idea if they're single plane gray scale. They're fluorescent images, thus the one red, one green, one blue and as I said I need to merge them (preferably to a tiff) to get the final image. I'm currently using an image analysis system to do this, but it's quite long and tedious and was hoping for the automatic batch processing option. I was afraid that it maybe to specific for the current offerings of Automator. I'll take a look at what lexfuzo has suggested but quite honestly I have no idea how to write shell scripts. Thanks a lot for all the help

lexfuzo
Nov 27, 2005, 08:32 AM
I'll take a look at what lexfuzo has suggested but quite honestly I have no idea how to write shell scripts.

Don't be afraid ;). A shell script is just a plain text file containing all the commands you want to use, one after the other (or in some loop structure)

So, let's say
convert red1.tif green1.tif blue1.tif -channel RGB -combine combined.tif
does what you need and the other files are named red2, green2 and so on.
then you could put all commands in one text file:
convert red1.tif green1.tif blue1.tif -channel RGB -combine combined1.tif
convert red2.tif green2.tif blue2.tif -channel RGB -combine combined2.tif
...
These strings you even can create with Excel or the like (CONCATENATE, ...)

Or you put it in a loop:
i=0
while [ $i -lt 1000 ]
do
convert red${i}.tif green$${i}.tif blue${i}.tif -channel RGB \
-combine combined${i}.tif
i=`expr $i + 1`
done

... or similar.
It's easier than you might expect and there are hundreds of tutorials on the web, for example this one:

http://w******dp.org/LDP/abs/html/

Good luck :)

neocell
Nov 27, 2005, 12:20 PM
Don't be afraid ;). A shell script is just a plain text file containing all the commands you want to use, one after the other (or in some loop structure)

So, let's say
convert red1.tif green1.tif blue1.tif -channel RGB -combine combined.tif
does what you need and the other files are named red2, green2 and so on.
then you could put all commands in one text file:
convert red1.tif green1.tif blue1.tif -channel RGB -combine combined1.tif
convert red2.tif green2.tif blue2.tif -channel RGB -combine combined2.tif
...
These strings you even can create with Excel or the like (CONCATENATE, ...)

Or you put it in a loop:
i=0
while [ $i -lt 1000 ]
do
convert red${i}.tif green$${i}.tif blue${i}.tif -channel RGB \
-combine combined${i}.tif
i=`expr $i + 1`
done

... or similar.
It's easier than you might expect and there are hundreds of tutorials on the web, for example this one:

http://w******dp.org/LDP/abs/html/

Good luck :)

Thanks a lot. You guys have been great