Write EXIF DateTimeOriginal example, please #1235
Replies: 2 comments 5 replies
|
Hi @GF-Huang here's an example. using (var image = new Image<Rgba32>(100, 100))
{
// Create a new profile, since we crated the image.
image.Metadata.ExifProfile = new ExifProfile();
const string format = "yyyy:MM:dd HH:mm:ss";
var now = DateTime.Now;
var dt = now.ToString(format);
// Set the metadata value.
image.Metadata.ExifProfile.SetValue(ExifTag.DateTimeOriginal, dt);
// Get the value.
var dt2 = image.Metadata.ExifProfile.GetValue(ExifTag.DateTimeOriginal).Value;
DateTime.TryParseExact(dt2, format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out DateTime now2);
}@dlemstra I wonder.... date and times are always formatted in the same way yeah? Should we provide an abstraction that allows direct get/set of |
4 replies
Answer selected by
GF-Huang
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @GF-Huang here's an example.
https://docs.sixlabors.com/api/ImageSharp/SixLabors.ImageSharp.Me…