johannesvollmer / exrs

100% Safe Rust OpenEXR file library
Other
149 stars 23 forks source link

Implement a poor man's `exrheader` #235

Open stevenparkerco3 opened 3 months ago

stevenparkerco3 commented 3 months ago

What can be improved or is missing?

To help expand on the example applications, it would be great to have an example application which can output EXR Header information in the same/similar format to OpenEXR's exrheader application. I believe this would help developers explore the exrs API's a bit further and lower the barrier to entry. In line with what OpenImageIO calls their "Poor man's exrheader" tool using iinfo, it would be nice to have a similar example in exrs.

Implementation Approach

I'm still learning Rust, and pretty terrible at it, but have the following Gist which is semi-functional: https://gist.github.com/stevenparkerco3/d49b21072670312443521931eb698e46

johannesvollmer commented 3 months ago

Yes, we also thought this might be useful. We planned to publish some simple tools similar to this as real binary creates, such that everyone can install them.

Unfortunately, no one had the time to actually do it. Feel free to proceed.

johannesvollmer commented 3 months ago

Here are more thoughts on your current status:

Header flags HEX Output

Is this actually useful for the user to see the hex codes? I think it would be much more useful to a human user to display the fields of the version struct. If you really want to display the hex code, the following section of source code might be interesting for you: Requirements::write

Some core header values are not parsed. Right now, it's just a hard coded list of some values I thought were important, but should extend to ALL values

We might want to add to the library a visitor pattern that visits each attribute. Do you think that makes sense? Something like:

header.visit_all_attributes(|name, value|{
    println!("{} (type {}): {}", ...);
})
johannesvollmer commented 2 months ago

https://github.com/johannesvollmer/exrs/pull/236/files

here is a prototype of the function, if you think it's useful, we can merge that