Add support for reading and writing grayscale PFM images by nulano · Pull Request #7696 · python-pillow/Pillow

Huh, I thought https://linux.die.net/man/5/pfm was identical to https://netpbm.sourceforge.net/doc/pfm.html, which says

The raster is a sequence of pixels, packed one after another, with no delimiters of any kind. They are grouped by row, with the pixels in each row ordered left to right and the rows ordered bottom to top.

From https://sourceforge.net/p/netpbm/code/1682/tree//userguide/pfm.html?diff=51243f8e2718460a4a53b63a:1681, it looks like this was changed in 2012, with "bottom to top" being the newer version. I suspect the doc file was wrong until then, since looking at the 10.22 release of netpbm from 2004, the HISTORY file shows that this is the version that added PFM support and the source code for the PFM utilities shows bottom to top order being used.

Similarly, Wikipedia says:

After the header the file proceeds with floating point numbers for each pixel, specified in left-to-right, bottom-to-top order. Some programs suggest PF4 as an additional extension for the RGBA format.

I've also tested Gimp, ImageMagick's convert, and libjxl's cjxl, and they all agree on bottom-to-top order.