Skip to content

Commit

Permalink
Merge pull request #2066 from SixLabors/js/exif-thumbnail
Browse files Browse the repository at this point in the history
Add non-generic overload for ExifProfile.CreateThumbnail<TPixel>().
  • Loading branch information
JimBobSquarePants authored Mar 16, 2022
2 parents 2bedf20 + d4acfce commit 136cc14
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/ImageSharp/Metadata/Profiles/Exif/ExifProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ public IReadOnlyList<IExifValue> Values
}
}

/// <summary>
/// Returns the thumbnail in the EXIF profile when available.
/// </summary>
/// <returns>
/// The <see cref="Image"/>.
/// </returns>
public Image CreateThumbnail() => this.CreateThumbnail<Rgba32>();

/// <summary>
/// Returns the thumbnail in the EXIF profile when available.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,15 @@ public void Values()

TestProfile(profile);

using Image<Rgba32> thumbnail = profile.CreateThumbnail<Rgba32>();
using Image thumbnail = profile.CreateThumbnail();
Assert.NotNull(thumbnail);
Assert.Equal(256, thumbnail.Width);
Assert.Equal(170, thumbnail.Height);

using Image<Rgba32> genericThumbnail = profile.CreateThumbnail<Rgba32>();
Assert.NotNull(genericThumbnail);
Assert.Equal(256, genericThumbnail.Width);
Assert.Equal(170, genericThumbnail.Height);
}

[Fact]
Expand Down

0 comments on commit 136cc14

Please sign in to comment.