Gimp use in Cytogenetics

I work on a research laboratory of cytogenetics (chromosomes). The CCD camera of the fluorescence microscope is black&white. Images of the chromosomes and of the signal (due to a probe) is recorded. Then the image with the signals is pseudocolored and superimposed to the chromosomes. To do that we used Photoshop CS6, and I made a specific macro (actions) for that. Now I want to do the same with Gimp, if possible.
To show what we do, I prepared a video and some snapshots. The video is heavy and I put in in Onedrive at this address (
Sign in to your account.

Let me know if it is possible to replicate the procedure in Gimp and if it can be simplifyed by macros.

Can you describe your procedure in words and maybe provide a sample image? we aren’t Photoshop experts (but back in 2014, I wrote a script to help someone from Sweden count bacteria).


It’s a bit hard to understand what you are doing in this video, even with the accompanying text in the video (and here). In any case, most of what you can do in Photoshop can be done in GIMP.

I made a specific macro (actions) for that.

We don’t have macros yet (likely at some point soon after GIMP 3.0 release), though we can write scripts (which can do much more). I assume the “Actions” is the list of macros?

In any case, seeing you clicking on actions can’t help us understand what the macros are for sure, since these are custom by definition. You should rather tell us “what you would have done manually (in longer steps possibly) if you hadn’t had your custom actions list”. Do you know? Or were these actions created by someone else and you have no idea what they are doing (doesn’t photoshop have an option to let you “reverse-engineer” an action to know what it does exactly?). Otherwise we can only guess.

Anyway the first action you click is called “RED”. I think your image is grayscale originally (the video is very blurry, but it looks like it’s written on the image title), so what this macro does is likely first transform it into a RGB image, with 8-bit per component. In GIMP, go in Image > Mode > RGB. It looks like your Photoshop macro stays in 8bpc, but I wonder if — for research imagery — you don’t want 16 (or even 32) bpc. And maybe you want to work in linear rather than according to a profile (it probably depend if the color you show has an accurate meaning, only you knows this; i.e. maybe you could color-pick a point and the value you get should tell you an information?). Anyway to change the precision, you could go to Image > Precision.

Then your formerly grayscale pixels go red. There are a bunch of filters able to do this. Once again, we cannot exactly guess, it depends on what your macro does. You could go to Colors > Colorize, raise saturation and ligthness and change into a red hue (I think you set hue to an extreme), though you don’t control the result as much.

If instead, you wanted to transform exactly a grayscale pixel value to to the same value in red for instance. So (0.1, 0.1, 0.1) grayscale should become (0.1, 0, 0) RGB, the channel Mixer might be what you want. Basically what you want is that red stays as-is, but the 2 other components should go (0, 0, 0), I think. Of course, you can do this in many other ways, like transforming the color to alpha, then alpha to selection, then filling it. Or using curves, and so on. It really depends what you actually want to do. Just “pseudocolored” does not mean much. The first question really is: is it just a beautify thing and you don’t care about the result or the red color has meaning in the end?

Then you click “APPLE-V” which apparently just pops up some dialog. And from the contents, it looks like you just also transform the second image from Grayscale to RGB, then blend the 2 images? Basically you just make one a layer on another then apply some blending mode and some opacity? We can’t really tell you which blend mode in GIMP is equivalent to what we see here. Blend modes are basically maths applied to pixel. You need to tell us what you are trying to do. Also once again, are you just looking for “nice to the eye” or for a mathematical meaning in colors (though seeing how you play with a slider manually, it looks like your process might just be about being “nice to the eye” as I don’t see how you will get any number accuracy, at least for the white part of the image, like this).

So yes, first you need to tell us what exactly each step of your process is trying to do, then you can easily do the same in GIMP, and once you found the manual process through the GUI, it’s easy to put it into a script doing the same in one or 2 clicks.

You’re using Photoshop’s “Blend if”, which is for GIMP similar than the Color to Alpha (top menu Colors > Color to Alpha)
Without the picture you’re using, I cannot really do what you were doing, so I just screenshoted your video, thus extremely far from a good example, but anyway, here a method than can be an “Action”, with Python, or the plug-in BIMP

I did colorize the “blurred one” (Colors > Colorize…)
screenshot here

Then once colorized, I did a Color to alpha, playing with sliders like in Photosop’s “Blend if”,
screenshots >

First of all thank you all for your interest.
Actions are macros in Photoshop. We’ve found macros to be very useful. The automation is so helpful for students who, this way, don’t need to go through a long series of commands to get the result.
To better explain what we do with macros, I am attaching two images. „Metaphase“ is the image of chromosomes taken with a black and white CCD camera under a microscope, using a specific filter for DAPI fluorescent staining, which stains all chromosomes. Then, to see the probe signals, the filter is changed to reveal Cy3 fluorescent staining (image of the signals). The goal is to see where along the chromosomes the signals are located. So, we pseudostain the signals (usually in red) and fuse them onto the chromosomes. „Fusing“ is not the correct word because the signals are superimposed on the chromosomes. But, in the signals image, the background must be removed. This is what the video shows.
No problem just add more details if needed.

I put the two images in the same folder of Onedrive, where there is the video tutorial

Sign in to your account.

I added more explanations below

Ok so let me try something:

  1. Load Signals.jpg in GIMP
  2. Go to Image > Encoding > 16-bit floating point and in the dialog which opens, choose Linear light. I’m not sure how true it is here, but very often for scientific imaging, you want to be in linear light because the image data actually represents something. Here you are saying it represents a “signal”. I am not biologist, but I guess that it might mean that if the pixel value is twice the value from another pixel, it means the signal is twice as “important” (whatever “important” means here)? And maybe you want to make sure that you keep this information. I don’t know, I have no idea what your “signal” is here.
  3. Now right click on your layer, and select “Add Layer Mask”.
  4. In the dialog appearing, select “Grayscale copy of layer”. So what does that mean now: since black is 0.0 and white is 1.0, the whiter the pixel, the higher the mask value. Layer masks are like an additional alpha channel, if you will, so it means that a completely white pixel will have a mask of 1.0, which makes it completely opaque; whereas a completely black pixel will have a mask of 0.0 which makes it completely transparent. And obviously an intermediate gray pixel will end up partially transparent.
    At this point, here is what it looks like:
  5. Now make your image RGB (you could have done this before, but since we were working with grayscale info until now, I thought it was simpler to work in grayscale): Image > Mode > RGB.
  6. So now, let’s add color. Click the FG color and choose the redder red (100.0, 0, 0).
  7. Make sure the layer is selected (not the mask) in the Layers dialog, by clicking the leftest square in the list, then drag and drop the FG color (you can also use the bucket fill, but dragging the color is the same in this specific case). What happens now is that the full layer becomes red. You lose all data in the layer… except the signals data is not actually lost, you copied it to the layer mask (as you recall, in step 4). And that makes your red stains (whiter is now redder):
  8. Finally add the file Metaphase.jpg as a second layer (either you drag’n drop the file in the canvas or you go to File > Open as layers). Make sure the new layer is below the Signals one by dragging it to the bottom.
    And done:
  9. The rendered result (not a screenshot in GIMP UI):

Maybe other processing can be done, but I don’t know the full meaning of your data and the full process. As a quick TODO, it looks like this is what you are after.

Interestingly in Firefox, the result is not rendering properly (what immediately strikes me is that chromosomes are less white in particular). That’s likely because our PNG is linear (if you recall) and browsers historically suck at color management (it is usually possible to have proper color management by going to some hidden setting somewhere). With a reader correctly managing colors, you usually get the right rendering.

Anyway in the end, if you wish to make sure your image is correctly displayed, even with software which really don’t care about color management, what you usually want is to go back at 8 bit per component, in perceptual gamma, and sRGB color profile (or no color profile, which most software will consider means sRGB). Here is again the same file after I converted back to 8bpc in perceptual and re-exported from GIMP:

(you might want both versions, I don’t know what you do with the image but if you were to use it for further processing, having more precision and being in linear is often better)

P.S.: of course, I showed you the manual in-GUI workflow, which is anyway very basic and done in less than a minute. But if you wanted to make it into a script, it’s very easy and possible. You could even make a script which could be run headless (GIMP could run it from command line without opening the GUI) if you wanted to process many images in batch very quickly, for instance. Everything is possible here.

I tried to follow step by step your instructions, but I found it difficult to find some command. It could be that I use a Mac or that the version of Gimp is different. i was not able, for instance, to do " Click the FG color and choose the redder red (100.0, 0, 0) ."
Consider that i never used Gimp.

FG = foreground.

Under the toolbox, you have 2 little squares, one for the foreground one, for the background color. These colors are used in the various tools. If you click any of these squares, a dialog opens allowing you to change the associated colors.
Here for instance, I set the FG color as red:


Because of that, I’ll try multiple posts… sorry about the policies of this forum


  1. Import your Metaphase first, then on top your Signals’ picture.
  2. Go to the top menu Image > Mode > RGB
  3. Then Create a new layer (the + icon at the bottom of the layer dialog/stack)

OK I can’t post anything else, I’m not able to help, too much restrained as new comer
tried to post this

Hi all, I am interested in how I can import a chromosome ideogram using something like and creating a ring from this. I think I would use a filter like a polar coordinates but I am not sure.

@jax_bree We’d be happy to help, but you need to speak our language, i.e. graphics language. I don’t think there are many people doing cytogenetics (or even knowing what this is) around. Likewise, I don’t know CyDAS (and looking the website you linked, it’s probably normal as it’s a software specifically for your field), have no idea what a “chromosome ideogram” is, or what you call a “ring” in this context.

You should look at the discussion above, how @Mariano_Rocchi explained their use case with images, video and workflow explanation so that we understand better what they were trying to do (and thus were able to help them, despite not knowing a thing about the Cytogenetics science field). This is what you should aim for, in order to get helped. :slight_smile:

Last but not least, I would suggest to open a dedicated thread for your specific problem. Even though the science field might be the same, as I understand you are asking about something else. Mixing questions by various people in a same thread is the recipe for a mess so that nobody understand anymore what’s being discussed.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.