Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use better image format #38

Open
9yz opened this issue Nov 12, 2021 · 3 comments
Open

Use better image format #38

9yz opened this issue Nov 12, 2021 · 3 comments

Comments

@9yz
Copy link

9yz commented Nov 12, 2021

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.

@manticorp
Copy link

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.

@9yz
Copy link
Author

9yz commented Sep 2, 2022

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

@manticorp
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants