Skip to content

[imageio] Recognize and correctly load PFM files saved by Photoshop #17716

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

Conversation

victoryforce
Copy link
Collaborator

We need to recognize whether the PFM file was written by Adobe Photoshop, which writes the image rows in a different order. Fortunately, an unknown Adobe programmer did two things differently, not just one, when implementing a PFM writer. Usually, the image width and height metadata are written in one line, separated by a space, followed by a newline character, followed by a scaling factor. In files created by Photoshop, the width and height are each on their own line.

@victoryforce
Copy link
Collaborator Author

@TurboGit Would you like me to provide a PFM file created in Photoshop for testing?

@TurboGit
Copy link
Member

@TurboGit Would you like me to provide a PFM file created in Photoshop for testing?

Yes please! I'll keep this beast around as I'm from time to time test loading different format to ensure we have no regression.

@TurboGit TurboGit added this to the 5.0 milestone Oct 25, 2024
@TurboGit TurboGit added bugfix pull request fixing a bug difficulty: trivial some changes in a couple of functions labels Oct 25, 2024
@victoryforce
Copy link
Collaborator Author

OK, I'll ask a friend who has an Adobe subscription to export another image (the one where I noticed the format differences had people's faces).

@victoryforce
Copy link
Collaborator Author

The image was saved as a PFM in Photoshop, zipped and attached.
freedom_is_our_religion - saved as pfm by photoshop.zip

Copy link
Member

@TurboGit TurboGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@TurboGit TurboGit merged commit 0ff76dd into darktable-org:master Oct 27, 2024
6 checks passed
@victoryforce victoryforce deleted the recognize-and-support-Adobe-PFM-flavor branch October 27, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix pull request fixing a bug difficulty: trivial some changes in a couple of functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants