Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Mar 31, 2024
1 parent 5b518ba commit b5af5fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/PicView.Avalonia/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ public void SetImageModel(ImageModel imageModel)
GetAuthors = getAuthors ?? string.Empty;
GetDateTaken = EXIFHelper.GetDateTaken(profile);
GetCopyright = profile?.GetValue(ExifTag.Copyright)?.Value ?? string.Empty;
GetTitle = profile?.GetValue(ExifTag.XPTitle)?.Value.ToString() ?? string.Empty;
GetTitle = EXIFHelper.GetTitle(profile);
GetSubject = profile?.GetValue(ExifTag.XPSubject)?.Value.ToString() ?? string.Empty;
GetSoftware = profile?.GetValue(ExifTag.Software)?.Value ?? string.Empty;
GetResolutionUnit = EXIFHelper.GetResolutionUnit(profile);
Expand Down
12 changes: 12 additions & 0 deletions src/PicView.Core/ImageDecoding/EXIFHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,4 +445,16 @@ public static string GetExifVersion(IExifProfile? profile)
var exifVersion = profile?.GetValue(ExifTag.ExifVersion)?.Value;
return exifVersion is null ? string.Empty : Encoding.ASCII.GetString(exifVersion);
}

public static string? GetTitle(IExifProfile? profile)
{
var xPTitle = profile?.GetValue(ExifTag.XPTitle)?.Value;
var title = xPTitle is null ? string.Empty : Encoding.ASCII.GetString(xPTitle);
if (!string.IsNullOrEmpty(title))
{
return title;
}
var titleTag = profile?.GetValue(ExifTag.ImageDescription)?.Value;
return titleTag ?? string.Empty;
}
}

0 comments on commit b5af5fb

Please sign in to comment.