Analysing RGB values for multiple images


I am currently doing my undergraduate project and I need to extract individual red, green, and blue colour values from my images. At the moment I am only able to do one image at a time using “Image -> Colour -> Make Composite”. However, I was wondering if there is a way to analyse multiple images at the same time?

Thank you.

Hello @Elise4,

What do you exactly need to do? Just separate the 3 channels? Image > Color > Split Channels… does that for you.

To analyze multiple images you might want to have a look at the possibilities that the macro language brings you to automatize simple processes.

I hope this helps.


1 Like

Hi @iarganda ,

Apologies for my late reply. I need to identify the separate red, green, and blue value for a section on the same image (i.e. select a section on the image and extract the individual R, G, B values for that specific section). I am looking at images of eggs and so I need to do this for the yolk area and the area surrounding it within the shell outline. In addition, I need to do this for three separate sections on the same area (e.g. three points on the yolk and three on the surrounding area) to take the average R, G, and B value later.

I have had a look at the selection of macros on the image j site and there is one called “Batch RGB Measure”. Do you think this would be suitable for what I am trying to do?

Thank you for your help.

If you’re selecting those areas by hand, the solution is simple:

  1. Convert your image to composite: Image > Color > Make Composite

  2. Call the ROI Manager (under Analyze > Tools).

  3. Select each area you want and add it one by one to the ROI Manager (click on Add [t])

  4. For each slice of your image and each area on the ROI Manager, click on Analyze > Measure or CTRL + M.

That way you can have a different measure per channel and area:

Remember you can automatize this process within a macro or script if you want.


Hi @iarganda ,

I have managed to create a macro which selects three points on the yolk and three on the area surrounding the yolk for each slice (i.e. red, green, and blue image) and then saves a file automatically with the image name and each measurement. My macro allows me to select where I’d like each rectangle to be and then records the measurement in the ROI manager box (giving a total of 18 measurements per image). However, I am still only able to do this on one image at a time. I was wondering if there is a way I can alter my macro to allow me to stack all the images I want to measure and simply go through each one in turn and select the rectangles as I go, giving one file at the end containing all the measurements for the group of images instead of a single results file for each individual image?

Thank you

Yes! Have a look at this macro example on how to process all images in a folder.

1 Like

Hello @Elise4,

In my master’s degree I’m analyzing coral images and I want to extract RGB values from specific selections in each photo, but until now I was able just to get values in a gray scale. Can you tell me how you got the RGB values?

Thank you.

Hi @BrunoLonz, Welcome to the forum !

You can have a look at getPixel() that allows to get values of a specific pixel. There is a macro example to get values of RGB images.
You can also use Image>Color>Split Channels to separate the channels and make some measurements on each separately.