I have to work with grayscale .pfm (Portable Bitmap) images that apparently Gimp can open. However, values are way higher than 1, like in range [1;280]. So every pixel appears white, with % values for red, green and blue like 150%.

How can I rescale Gimp colors for rendering only, like a pixel with value 280.0 will be white and a pixel 1.0 black ?

  • Can you post a sample file somewhere? According to this the third line of the file is the range used (so if 280.0 is white, the third line of your file should be 280.0 or -280.0 depending on endianness).
    – xenoid
    Commented Aug 1, 2022 at 22:30
  • Of course, here is the link: ufile.io/iinl2cdj (8Mo, too big for SE). I don't remember if the range is really [1.0;280.0] but it should be something like it.
    – rafoo
    Commented Aug 2, 2022 at 9:51

2 Answers 2


You could try a levels adjustment to stretch the colours out. All the detail seems to be crushed up in the whites. Whether or not this is the desired result I can't be sure, but there's definitely an image in there.

Do Colors > Levels and drag the tiny black arrow in the Input Levels all the way to the right

enter image description here

  • I just need for roughly visualizing if the result looks like something and is not random data. The scene are random object so its normal to be a little "messed-up"
    – rafoo
    Commented Aug 2, 2022 at 10:49

Your file has a range line (3rd line) that says -1.000000 so the indicated range isn't coherent with the encoded values if they can go up to 280.

Replacing (with an hex editor) the -1.000000 with -280.0000 (same endianness) does yield a useful result (all white), but using 280.00000 (opposite endianness) yields this:

enter image description here

  • You're right. The images are used for deep learning. The neural network don't use the range in the header so it will always be let at -1, but it can mess up gimp.
    – rafoo
    Commented Aug 2, 2022 at 10:47

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.