Browse Source

Merge pull request #2066 from SixLabors/js/exif-thumbnail

Add non-generic overload for ExifProfile.CreateThumbnail<TPixel>().
pull/2081/head v2.1.0
James Jackson-South 4 years ago
committed by GitHub
parent
commit
136cc143bb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/ImageSharp/Metadata/Profiles/Exif/ExifProfile.cs
  2. 7
      tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs

8
src/ImageSharp/Metadata/Profiles/Exif/ExifProfile.cs

@ -121,6 +121,14 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
} }
} }
/// <summary>
/// Returns the thumbnail in the EXIF profile when available.
/// </summary>
/// <returns>
/// The <see cref="Image"/>.
/// </returns>
public Image CreateThumbnail() => this.CreateThumbnail<Rgba32>();
/// <summary> /// <summary>
/// Returns the thumbnail in the EXIF profile when available. /// Returns the thumbnail in the EXIF profile when available.
/// </summary> /// </summary>

7
tests/ImageSharp.Tests/Metadata/Profiles/Exif/ExifProfileTests.cs

@ -354,10 +354,15 @@ namespace SixLabors.ImageSharp.Tests.Metadata.Profiles.Exif
TestProfile(profile); TestProfile(profile);
using Image<Rgba32> thumbnail = profile.CreateThumbnail<Rgba32>(); using Image thumbnail = profile.CreateThumbnail();
Assert.NotNull(thumbnail); Assert.NotNull(thumbnail);
Assert.Equal(256, thumbnail.Width); Assert.Equal(256, thumbnail.Width);
Assert.Equal(170, thumbnail.Height); 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] [Fact]

Loading…
Cancel
Save