Write EXIF DateTimeOriginal example, please #1235
-
How to do that? |
Beta Was this translation helpful? Give feedback.
Answered by
JimBobSquarePants
Jun 22, 2020
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 |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
GF-Huang
-
Yo @GF-Huang did that answer your question? |
Beta Was this translation helpful? Give feedback.
1 reply
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…