In Gimp I want to generate a gray scale image of a RGB image defined by this per-pixel formula: value_xy = max(R_xy, G_xy, B_xy).

I didn't find a builtin feature so I wonder if there's some generic filter out there where I can operate on a per-pixel basis by just defining some formula.

Is there something like this already? Would I have to write my own filter for Gimp?

1 Answer 1


No need for specific filter...

  • Color>Components>Decompose and use RGB Model, you get a grayscale image where each layer is one of the RGB channels of the original image
  • Set the top two layers to Lighten only mode.

enter image description here

  • I've changed the title to match your answer :) This is what I've been looking for - but since you seem to know Gimp - do you know the answer to the original Question? Is there a builtin way (or an existing filter) which allows me to calculate color values with functional expressions on a per-pixel basis?
    – frans
    Commented Apr 24, 2017 at 7:10
  • Not as far as I know. Since you are usually dealing with millions of pixels, this is best done with a compiled language, in other words in a C plugin. The other (and likely more palatable option) is to write a filter for the GMIC processor, that works as a Gimp plugin or as command-line processor. But you may also find frameworks to do this kind of job in a command line program/script. For instance, there is the pillow module for Python.
    – xenoid
    Commented Apr 24, 2017 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.