'How do I extract a jpeg's EXIF thumbnail using ImageSharp?

I am trying to extract thumbnails from source jpegs and save them to the file system, using the C# ImageSharp library. I see there is some mention of it in the intellisense for the component: SixLabors.ImageSharp.Image.Metadata.ExifProfile.CreateThumbnail()

...but I can't seem to find any documentation for it or examples to call it correctly.

I did find this:

using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;  

//method code:
Image<TPixel> thumbnail = image.Metadata.ExifProfile.CreateThumbnail<TPixel>();

https://docs.sixlabors.com/api/ImageSharp/SixLabors.ImageSharp.Metadata.Profiles.Exif.ExifProfile.html

...but I need to find where the TPixel type is to get it to work. VisualStudio doesn't recognize it and I can't seem to find a namespace or use it correctly:

"The type or namespace name 'TPixel' could not be found (are you missing a using directive or an assembly reference?)"

Legacy Windows .NET Framework could do this for System.Drawing.Image.Image.GetThumbnailImage() and it worked pretty well.

EDIT: Using tocsoft's answer, I changed the code to:

if (image.Metadata.ExifProfile != null)
{
    Image<Rgba32> thumbnail = image.Metadata.ExifProfile.CreateThumbnail<Rgba32>();

    thumbnail.Save(thumbnailPath, encoder);
}

...however, the image.Metadata.ExifProfile is null, which is unexpected since I know these source images have EXIF data.

EDIT: Actually, it's working now. Success! Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source