In Gimp, how can I multiply the value of every pixel in a grayscale image by a constant value? For example, multiply each pixel by 2.

3 Answers 3


I thought of an additional way to do it:

Select the layer you want to multiply, then go to Filters -> Generic -> Convolution Matrix.

In the window that pops up, leave all the cells at zero except for the center cell which you should set to the value you wish to multiply by. It should look like this:

Convolution Matrix window

  • It should do the trick (until your start values are less than 128 or if your Gimp version is able to manage grayscale images deeper than 8 bits). If this way solves your problem, you can mark your own solution as a correct answer. Commented Dec 4, 2013 at 9:03
  • So you're saying the pixel values must be less than 128 or else they will be saturated after multiplying by 2, right?
    – Garrett
    Commented Dec 4, 2013 at 20:18
  • 1
    Exactly, until you use a 8-bit grayscale image. Future versions of Gimp should be able to manage deeper depth. Commented Dec 5, 2013 at 10:00
  • Cool, thanks! By the way, I think you mean "assuming" instead of "until".
    – Garrett
    Commented Dec 5, 2013 at 20:28
  • My English needs some improvement... ;-) Commented Dec 6, 2013 at 17:13

Another way to think of this problem, instead of saying that you are multiplying each pixel value by 2, is to say that your are taking pixels in the range of (0,127) and are stretching them to fill the whole range (0,255).

When you look at it that way, it is very easily done in the "Levels" tool.

Set the input levels "white point" to 127, and leave the output levels "white point" as 255, and everything will be scaled up.

Image of GIMP Levels dialog with settings as described in text

For other multiplication factors, you just have to do a quick calculation to figure out what input value should equal 255 output.

If you wanted to divide the pixel values for some reason, you would leave the input white point as 255 and reduce the maximum output level.


Pixel math is tricky (and a little slow) in Gimp, either using a script (i.e. invoking for each pixel gimp-drawable-set-pixel with Script-Fu or Python-Fu ) or using plug-ins like MathMap.

Note that multiplying by a constant could increase the value of the pixels over the maximum range for the image, and after the operation you can have some saturated areas. I don't know if the current version of Gimp has already a built-in support for working with 16-bit (or more) grayscale images and I suggest you to perform pixel multiplications with ImageJ which, despite the poor user interface, is very fast and useful for this kind of operations, and can manage values up to 32-bit grayscale images.

Gimp is a great image manipulation program, but in this case I think that ImageJ could be a more proper tool.

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.