tangrams / heightmapper

interactive heightmaps from terrain data

Home Page:http://tangrams.github.io/heightmapper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use better image format

9yz opened this issue · comments

commented

Howdy,
With heightmaps, it's generally not a good idea to use the PNG file format, because it distorts the data, making darker colors darker and lighter colors lighter. I'd like to suggest adding the ability to export files as a TIF(F) or OpenEXR.

Thanks.

Because of sRGB gamma scaling? that doesn't really matter, because it's the numbers in the file that are read - irrespective of the colour space.

commented

Just because it's possible, doesn't mean it's convenient. Some programs don't have the option to correct for file format fuckery. There's a reason most professional GIS applications use GeoTIFF for everything raster. https://en.wikipedia.org/wiki/GeoTIFF

Sorry, maybe I misunderstood - why would PNG distort the data?

From what I understand, the distortion you describe would come from gamma scaling due to PNG only really supporting sRGB data, and sRGB having a 2.2 gamma scaling.

But if the data is written assuming this (which in this case, it is, I believe) - then it doesn't matter as no colour space conversion is happening.

At the end of the day, PNG is being used as a convenience format for transporting the data - it is the numbers in the file that matter, and the numbers aren't being scaled - a 1 is mapping to a 1, and 128 is mapping to 128, 255 to 255 and so forth.

I can understand the want for different file format exports, but in this case there should be no gamma scaling as you describe.

If you're using this to visually display data, then you are correct, a 2.2 gamma scaling should be applied to accurately display the data for human vision - but this would be a discrepancy if the file was saved as GeoTIFF as well.