Closed TzuChieh closed 6 months ago
Hi TzuChieh,
As you noted, there isn't universal agreement about the order pixels should be stored in a PFM, and (as far as I know), there is no way to determine this automatically from the header.
HDRView uses the same convention as Photoshop (as this is the tool I otherwise use most). Unfortunately, this is the opposite convention as macOS's Preview and Quicklook, and seemingly Gimp as well.
A work-around is to manually flip the pixels after you load them. Just open up the command palette and type "flip" and it should show up (or hit Opt+V"
I'm going to mark this as closed for now. If you come up with a satisfying way to resolve this that doesn't simply shift the problem to files generated with software using the other convention, then please add a new comment or pull request and we can continue to discuss.
Hi Wojciech,
Thank you for the tips! I am using Alt+V to flip PFM images for now and it works really well. Currently I cannot come up with a way to handle this without encoding new information into the file. Amazing software by the way 🙂!
According to some sources[1][2], the .pfm format contains raster data ordered from left to right, bottom to top. However, I do find a disagreement[3]. I have attached an example .pfm file example.zip showing an area light shining the ground below it.
This is what GIMP 2.10.36 shows:![image](https://github.com/wkjarosz/hdrview/assets/9410143/9ad8df97-d368-4e2b-a53c-95f14bc0de35)
And this is from HDRView v1.8.0 (64 bit Windows build):![image](https://github.com/wkjarosz/hdrview/assets/9410143/b1099d09-3333-4726-85fe-d8cb94fe3ec0)
[1] https://www.pauldebevec.com/Research/HDR/PFM/ [2] The "PFM raster" section of https://netpbm.sourceforge.net/doc/pfm.html [3] The "PFM raster" section of https://linux.die.net/man/5/pfm