diff --git a/src/encoder/mod.rs b/src/encoder/mod.rs index c5c8e72..e67d76b 100644 --- a/src/encoder/mod.rs +++ b/src/encoder/mod.rs @@ -294,7 +294,7 @@ impl<'a, W: 'a + Write + Seek, K: TiffKind> DirectoryEncoder<'a, W, K> { /// Write a tag-value pair with prepared byte data. /// /// Note that the library will _not_ attempt to verify that the data type or the count of the - /// opaque value is permissible for the given tag. The data will be associated with the tag + /// buffered value is permissible for the given tag. The data will be associated with the tag /// exactly as-is. /// /// An error is returned if the byte order of the presented value does not match the byte order diff --git a/src/tags.rs b/src/tags.rs index fe0c697..aa82e3e 100644 --- a/src/tags.rs +++ b/src/tags.rs @@ -1,4 +1,4 @@ -use crate::decoder::ifd; +use crate::{decoder::ifd, encoder::TiffValue}; macro_rules! tags { { @@ -362,6 +362,15 @@ impl ValueBuffer { } } + /// Create a value with native byte order from in-memory data. + pub fn from_value(value: &T) -> Self { + ValueBuffer { + bytes: value.data().into_owned(), + ty: ::FIELD_TYPE, + byte_order: ByteOrder::native(), + } + } + pub fn byte_order(&self) -> ByteOrder { self.byte_order }