Split Channels in Batch Process

Hi Everyone!

I’m having trouble with splitting images into rgb channels when using a batch process. The script should be very simple:

dir1 = getDirectory("Input directory");
dir2 = getDirectory("Output directory ");
list = getFileList(dir1);


for (i=0; i<list.length; i++) {
 	showProgress(i+1, list.length);
        run("Split Channels");


Of course this is just part of the script, but it’s only in this section I´m having headaches. The problem is that the script doesn’t split the channels, it just opens the image and nothing else happens. There’s no error dialog popping out neither. Strange thing is that, when I run a macro containing the instructions below it does split into the 3 rgb channels:

open("Image Directory");
run ("Split Channels");


I’ve searched everywhere for a solution, but nobody seems to have the same issue.


will hide the newly opened images.

Set true to false, and you’ll see the script is working as intended.


Thank you so much. It worked as you said. What a silly mistake. Thank you again.

I have the same interest to split RGB images in batch: could you please refer me to the relevant macro or plug in for that. I am a newby in ImageJ…