-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
awaiting-c++-fixAwaiting fix in C++ XMP ToolkitAwaiting fix in C++ XMP Toolkit
Description
For files that have XMP embedded in the image file itself, like JPG. The XmpFile::put_xmp function is overwriting the Date Created property of that file. What's even weirder is it only changes it the first time I copy the photos from an IPhone that clicked the photos to my laptop. On subsequent runs only the Date Modified is changed, which is expected.
Expected Behaviour
Only the Date Modified should change and the Date Created should not be affected.
Actual Behaviour
Date Created is changed on the first run.
Steps to Reproduce
use xmp_toolkit::{OpenFileOptions, XmpFile, XmpValue};
fn set_image_metadata(
file_path: &str,
label: &str,
rating: i32,
) -> Result<(), Box<dyn std::error::Error>> {
let mut file = XmpFile::new().unwrap();
file.open_file(file_path, OpenFileOptions::default().for_update())
.unwrap();
let mut xmp_meta = file.xmp().unwrap();
xmp_meta.set_property(
"http://ns.adobe.com/xap/1.0/",
"Label",
&XmpValue::from(label),
)?;
xmp_meta.set_property(
"http://ns.adobe.com/xap/1.0/",
"Rating",
&XmpValue::from(rating.to_string()),
)?;
file.put_xmp(&xmp_meta).unwrap();
file.try_close().unwrap();
Ok(())
}
fn main() {
let file_path = "";
set_image_metadata(file_path, "Red", 1).unwrap();
}- Click a JPG photo from your phone.
- Copy the photo over your PC.
- Run the above code on your photo.
- Watch the
Creation Timechange from when you clicked the photo to the time you ran the code. - On subsequent runs of the same code, the
Creation Timeis not changed anymore, it stays on the time you first ran the code.
Platform and Version
xmp_toolkit: 1.9.1
rustc: 1.82.0
Reproduced on M1 MacOS and Windows 11
Metadata
Metadata
Assignees
Labels
awaiting-c++-fixAwaiting fix in C++ XMP ToolkitAwaiting fix in C++ XMP Toolkit