VideoThumbnailerGenerateThumbnail(Int32, Boolean, Int32) Method

Generates a meaningful thumbnail for the video by seeking to a sensible time position and avoiding blank frames. Every call returns a new Image instance which should be disposed by the caller. Once the smart time position is determined after the first call, the consecutive calls will be faster and can be used to retrieve Image instances in different sizes.

Definition

Namespace: GleamTech.VideoUltimate
Assembly: GleamTech.VideoUltimate (in GleamTech.VideoUltimate.dll) Version: 3.8.7
C#
public Image GenerateThumbnail(
	int maxSize,
	bool overlayDuration = false,
	int fontSize = 0
)

Parameters

maxSize  Int32
The maximum width or height of the thumbnail, aspect ratio is preserved. If width is bigger than height, than the value would be maximum width else it would be maximum height. If value is 0, original width and height will be used.
overlayDuration  Boolean  (Optional)
Whether to overlay the duration of the video on the bottom-right corner.
fontSize  Int32  (Optional)
The font size to be used for duration overlay. If value is 0, font size will be automatically calculated according to height.

Return Value

Image
A new Image instance.

Example

Casting from/to System.Drawing.Bitmap and System.Drawing.Image:

C#
GleamTech.Drawing.Image image;
var sdBitmap = new System.Drawing.Bitmap("Test.bmp");
var sdImage = System.Drawing.Image.FromFile("Test.jpg");

//Casting from System.Drawing.Bitmap:
//Use extension method ToGleamTechDrawingImage
image = sdBitmap.ToGleamTechDrawingImage();
//Or use explicit casting
image = (GleamTech.Drawing.Image)sdBitmap;

//Casting to System.Drawing.Bitmap:
//Use extension method ToSystemDrawingBitmap
sdBitmap = image.ToSystemDrawingBitmap();
//Or use explicit casting
sdBitmap = (System.Drawing.Bitmap)image;

//---------------------------------------

//Casting from System.Drawing.Image:
//Use extension method ToGleamTechDrawingImage
image = sdImage.ToGleamTechDrawingImage();
//Or use explicit casting
image = (GleamTech.Drawing.Image)sdImage;

//Casting to System.Drawing.Image:
//Use extension method ToSystemDrawingImage
sdImage = image.ToSystemDrawingImage();
//Or use explicit casting
sdImage = (System.Drawing.Image)image;

Casting from/to SixLabors.ImageSharp.Image:

C#
//Casting from SixLabors.ImageSharp.Image:
//Use extension method ToGleamTechDrawingImage
image = sisImage.ToGleamTechDrawingImage();
//Or use explicit casting
image = (GleamTech.Drawing.Image)sisImage;

//Casting to SixLabors.ImageSharp.Image:
//Use extension method ToImageSharpImage
sisImage = image.ToImageSharpImage();
//Or use explicit casting
sisImage = (SixLabors.ImageSharp.Image)image;

Casting from/to SkiaSharp.SKBitmap and SkiaSharp.SKImage:

C#
GleamTech.Drawing.Image image;
var skBitmap = SkiaSharp.SKBitmap.Decode("Test.bmp");
var skImage = SkiaSharp.SKImage.FromBitmap(skBitmap);

//Casting from SkiaSharp.SKBitmap:
//Use extension method ToGleamTechDrawingImage
image = skBitmap.ToGleamTechDrawingImage();
//Or use explicit casting
image = (GleamTech.Drawing.Image)skBitmap;

//Casting to SkiaSharp.SKBitmap:
//Use extension method ToSkiaSharpBitmap
skBitmap = image.ToSkiaSharpBitmap();
//Or use explicit casting
skBitmap = (SkiaSharp.SKBitmap)image;

//---------------------------------------

//Casting from SkiaSharp.SKImage:
//Use extension method ToGleamTechDrawingImage
image = skImage.ToGleamTechDrawingImage();
//Or use explicit casting
image = (GleamTech.Drawing.Image)skImage;

//Casting to SkiaSharp.SKImage:
//Use extension method ToSkiaSharpImage
skImage = image.ToSkiaSharpImage();
//Or use explicit casting
skImage = (SkiaSharp.SKImage)image;

Casting from/to Microsoft.Maui.Graphics.Platform.PlatformImage:

C#
GleamTech.Drawing.Image image;
var mgImage = new Microsoft.Maui.Graphics.Platform.PlatformImage(imageBytes);

//Casting from Microsoft.Maui.Graphics.Platform.PlatformImage:
//Use extension method ToGleamTechDrawingImage
image = mgImage.ToGleamTechDrawingImage();
//Or use explicit casting
image = (GleamTech.Drawing.Image)mgImage;

//Casting to Microsoft.Maui.Graphics.Platform.PlatformImage:
//Use extension method ToMauiGraphicsImage
mgImage = image.ToMauiGraphicsImage();
//Or use explicit casting
mgImage = (Microsoft.Maui.Graphics.Platform.PlatformImage)image;

See Also