Errors fix, removed old library, Added logging
This commit is contained in:
parent
8048c41cd0
commit
d8d8b152bd
6 changed files with 179 additions and 89 deletions
|
|
@ -148,39 +148,36 @@ public class ImageCreatorSharp
|
|||
|
||||
private void ExtractExif()
|
||||
{
|
||||
using (var img = SixLabors.ImageSharp.Image.Load(_workFile.FullName))
|
||||
using var img = SixLabors.ImageSharp.Image.Load(_workFile.FullName);
|
||||
_orientation = ExifReader.Orientations.TopLeft;
|
||||
|
||||
IExifValue<ushort> rotation = null;
|
||||
|
||||
var found = img.Metadata?.ExifProfile?.TryGetValue(ExifTag.Orientation, out rotation) ?? false;
|
||||
|
||||
if (found )
|
||||
{
|
||||
_orientation = ExifReader.Orientations.TopLeft;
|
||||
var intOrientation = rotation.Value.ToInt32();
|
||||
_orientation = (ExifReader.Orientations)intOrientation;
|
||||
}
|
||||
|
||||
IExifValue<ushort> rotation = null;
|
||||
|
||||
var found = img.Metadata?.ExifProfile?.TryGetValue(ExifTag.Orientation, out rotation) ?? false;
|
||||
|
||||
if (found)
|
||||
IExifValue<string> date = null;
|
||||
var creationFound = img.Metadata?.ExifProfile?.TryGetValue(ExifTag.DateTime, out date) ?? false;
|
||||
if (creationFound)
|
||||
{
|
||||
var succ = DateTime.TryParse(date.ToString(), out var crDate);
|
||||
if (succ)
|
||||
{
|
||||
_orientation = (ExifReader.Orientations)rotation.ToInt32();
|
||||
}
|
||||
|
||||
IExifValue<string> date = null;
|
||||
var creationFound = img.Metadata?.ExifProfile?.TryGetValue(ExifTag.DateTime, out date) ?? false;
|
||||
if (creationFound)
|
||||
{
|
||||
var succ = DateTime.TryParse(date.ToString(), out var crDate);
|
||||
if (succ)
|
||||
{
|
||||
_creationDate = crDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
_creationDate = null;
|
||||
}
|
||||
_creationDate = crDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
_creationDate = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_creationDate = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue