| 1 | |
| 2 | |
| 3 | // exr imports |
| 4 | extern crate exrrust-analyzer cargo exr 1.74.0 exr/; |
| 5 | |
| 6 | /// Print the custom meta data of a file, excluding technical encoding meta data. |
| 7 | /// Prints compression method and tile size, but not purely technical data like chunk count. |
| 8 | fn mainrust-analyzer cargo exr 1.74.0 main().() { |
| 9 | use exrrust-analyzer cargo exr 1.74.0 crate/::preluderust-analyzer cargo exr 1.74.0 prelude/::*; |
| 10 | |
| 11 | let meta_data = MetaDatarust-analyzer cargo exr 1.74.0 meta/MetaData#::read_from_filerust-analyzer cargo exr 1.74.0 meta/impl#[MetaData]read_from_file().( |
| 12 | "generated_rgba_with_meta.exr", |
| 13 | false // do not throw an error for invalid or missing attributes, skipping them instead |
| 14 | ).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("run example `1_write_rgba_with_metadata` to generate the required file"); |
| 15 | |
| 16 | for (layer_index, image_layer) in meta_data.headersrust-analyzer cargo exr 1.74.0 meta/MetaData#headers..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 17 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!( |
| 18 | "custom meta data of layer #{}:\n{:#?}", |
| 19 | layer_index, image_layer.own_attributesrust-analyzer cargo exr 1.74.0 meta/header/Header#own_attributes. |
| 20 | ); |
| 21 | } |
| 22 | } |