parse SubsecTimeOriginal
This commit is contained in:
parent
5d70b4c54b
commit
4f86338a3e
12
Photo.cs
12
Photo.cs
@ -172,7 +172,6 @@ public class Photo {
|
|||||||
String.Format("{0:D2}", DateTimeOriginal.Day));
|
String.Format("{0:D2}", DateTimeOriginal.Day));
|
||||||
Directory.CreateDirectory(directory);
|
Directory.CreateDirectory(directory);
|
||||||
string filename = System.IO.Path.Combine(directory, System.IO.Path.GetFileName(Filename));
|
string filename = System.IO.Path.Combine(directory, System.IO.Path.GetFileName(Filename));
|
||||||
Console.WriteLine("saving " + filename);
|
|
||||||
// FIXME: add comments / captions as ImageDescription?
|
// FIXME: add comments / captions as ImageDescription?
|
||||||
// FIXME: warn if the file already exists?
|
// FIXME: warn if the file already exists?
|
||||||
using (Image<Rgba32> image = await Image.LoadAsync<Rgba32>(Filename)) {
|
using (Image<Rgba32> image = await Image.LoadAsync<Rgba32>(Filename)) {
|
||||||
@ -210,6 +209,7 @@ public class Photo {
|
|||||||
image.Metadata.XmpProfile = UpdateXmp(image.Metadata.XmpProfile);
|
image.Metadata.XmpProfile = UpdateXmp(image.Metadata.XmpProfile);
|
||||||
|
|
||||||
await image.SaveAsync(filename, encoder);
|
await image.SaveAsync(filename, encoder);
|
||||||
|
Console.WriteLine("saved " + filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +347,6 @@ public class Photo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: there is also a SubSecTimeOriginal tag we could use to get fractional seconds.
|
|
||||||
// FIXME: I think the iPhone stores time in UTC but other cameras report it in local time.
|
// FIXME: I think the iPhone stores time in UTC but other cameras report it in local time.
|
||||||
IExifValue<string>? dateTimeOriginal;
|
IExifValue<string>? dateTimeOriginal;
|
||||||
if (exifs.TryGetValue(ExifTag.DateTimeOriginal, out dateTimeOriginal)) {
|
if (exifs.TryGetValue(ExifTag.DateTimeOriginal, out dateTimeOriginal)) {
|
||||||
@ -364,6 +363,13 @@ public class Photo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IExifValue<string>? subsecTimeOriginal;
|
||||||
|
if (exifs.TryGetValue(ExifTag.SubsecTimeOriginal, out subsecTimeOriginal)) {
|
||||||
|
double fractionalSeconds;
|
||||||
|
Double.TryParse("0." + subsecTimeOriginal.Value, out fractionalSeconds);
|
||||||
|
DateTimeOriginal = DateTimeOriginal.AddSeconds(fractionalSeconds);
|
||||||
|
}
|
||||||
|
|
||||||
Gps = GpsInfo.ParseExif(exifs);
|
Gps = GpsInfo.ParseExif(exifs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,7 +414,7 @@ public class Photo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string Description() {
|
public string Description() {
|
||||||
string date = DateTimeOriginal.ToString("yyyy-MM-dd HH:mm:ss");
|
string date = DateTimeOriginal.ToString("yyyy-MM-dd HH:mm:ss.ff");
|
||||||
return String.Format(
|
return String.Format(
|
||||||
"{0,6} {1,-5} {2,-7} {3,-10} {7,4}x{8,-4} {4} {5,-20} {6}",
|
"{0,6} {1,-5} {2,-7} {3,-10} {7,4}x{8,-4} {4} {5,-20} {6}",
|
||||||
FocalLength, FNumber, ExposureTime, IsoSpeed, date, ShortLensModel, Filename, Size.X, Size.Y);
|
FocalLength, FNumber, ExposureTime, IsoSpeed, date, ShortLensModel, Filename, Size.X, Size.Y);
|
||||||
|
@ -697,10 +697,10 @@ public class Game : GameWindow {
|
|||||||
// string[] files = Directory.GetFiles(@"c:\users\colin\pictures\photos\2023\07\23\");
|
// string[] files = Directory.GetFiles(@"c:\users\colin\pictures\photos\2023\07\23\");
|
||||||
// string[] files = Directory.GetFiles(@"G:\DCIM\100EOSR6\");
|
// string[] files = Directory.GetFiles(@"G:\DCIM\100EOSR6\");
|
||||||
// string[] files = Directory.GetFiles(@"c:\users\colin\desktop\totte-output\2023\08\29");
|
// string[] files = Directory.GetFiles(@"c:\users\colin\desktop\totte-output\2023\08\29");
|
||||||
// string[] files = Directory.GetFiles(@"c:\users\colin\desktop\import");
|
string[] files = Directory.GetFiles(@"c:\users\colin\desktop\import");
|
||||||
// string[] files = Directory.GetFiles(@"C:\Users\colin\Pictures\photos\2018\06\23");
|
// string[] files = Directory.GetFiles(@"C:\Users\colin\Pictures\photos\2018\06\23");
|
||||||
// string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\Germany all\104D7000");
|
// string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\Germany all\104D7000");
|
||||||
string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\many-birds\");
|
// string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\many-birds\");
|
||||||
|
|
||||||
for (int i = 0; i < files.Count(); i++) {
|
for (int i = 0; i < files.Count(); i++) {
|
||||||
string file = files[i];
|
string file = files[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user