diff --git a/src/encoder/mod.rs b/src/encoder/mod.rs index 9f4ec28..09bd61e 100644 --- a/src/encoder/mod.rs +++ b/src/encoder/mod.rs @@ -777,7 +777,15 @@ impl Default for EncodeMetadataOptions<'_> { #[non_exhaustive] #[derive(Clone, Copy, Default)] pub struct EncodeMetadataApplicability { + /// The photometric interpretation of the image data. + /// + /// If `None` then metadata tags are not filtered, otherwise only tags applicable to the given + /// photometric interpretation are recorded. pub photometric: Option, + /// The planar configuration of the image data. + /// + /// If `None` then metadata tags are not filtered, otherwise only tags applicable to the given + /// configuration are recorded. pub planar: Option, } diff --git a/src/encoder/tag_filter.rs b/src/encoder/tag_filter.rs index 5b7ffef..cc3cc90 100644 --- a/src/encoder/tag_filter.rs +++ b/src/encoder/tag_filter.rs @@ -169,16 +169,10 @@ impl TagFilter { Level::Photometric(photometric) => { match (photometric, target.planar, target.photometric) { (Photometric::All, _, _) => Choice::Ok, - (Photometric::Planar, Some(PlanarConfiguration::Planar), _) => Choice::Ok, - (Photometric::Planar, None, _) - if matches!(self.filter_level, FilterLevel::All) => - { + (Photometric::Planar, Some(PlanarConfiguration::Planar) | None, _) => { Choice::Ok } - (Photometric::YCbCr, _, Some(PhotometricInterpretation::YCbCr)) => Choice::Ok, - (Photometric::YCbCr, _, None) - if matches!(self.filter_level, FilterLevel::All) => - { + (Photometric::YCbCr, _, Some(PhotometricInterpretation::YCbCr) | None) => { Choice::Ok } _ => Choice::Discard,