VideoThumbnailerGenerateThumbnail(Int32, 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.
Namespace: GleamTech.VideoUltimateAssembly: GleamTech.VideoUltimate (in GleamTech.VideoUltimate.dll) Version: 4.4.7
public Image GenerateThumbnail(
int width,
int height,
bool overlayDuration = false,
int fontSize = 0
)
Public Function GenerateThumbnail (
width As Integer,
height As Integer,
Optional overlayDuration As Boolean = false,
Optional fontSize As Integer = 0
) As Image
- width Int32
- The width of the thumbnail. If value is 0, width will be automatically calculated to preserve aspect ratio.
- height Int32
- The height of the thumbnail. If value is 0, height will be automatically calculated to preserve aspect ratio.
- 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.
ImageA new
Image instance.
A
GleamTech.Drawing.Image parameter/property can be explicitly cast from/to other image libraries:
Below are the examples for casting a
Image parameter/property from/to other image libraries.
Casting from/to System.Drawing.Bitmap and System.Drawing.Image:
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;
Dim image As GleamTech.Drawing.Image
Dim sdBitmap As New System.Drawing.Bitmap("Test.bmp")
Dim sdImage As Object = System.Drawing.Image.FromFile("Test.jpg")
'Casting from System.Drawing.Bitmap:
'Use extension method ToGleamTechDrawingImage
image = sdBitmap.ToGleamTechDrawingImage()
'Or use explicit casting
image = CType(sdBitmap, GleamTech.Drawing.Image)
'Casting to System.Drawing.Bitmap:
'Use extension method ToSystemDrawingBitmap
sdBitmap = image.ToSystemDrawingBitmap()
'Or use explicit casting
sdBitmap = CType(image, System.Drawing.Bitmap)
'---------------------------------------
'Casting from System.Drawing.Image:
'Use extension method ToGleamTechDrawingImage
image = sdImage.ToGleamTechDrawingImage()
'Or use explicit casting
image = CType(sdImage, GleamTech.Drawing.Image)
'Casting to System.Drawing.Image:
'Use extension method ToSystemDrawingImage
sdImage = image.ToSystemDrawingImage()
'Or use explicit casting
sdImage = CType(image, System.Drawing.Image)
Casting from/to SixLabors.ImageSharp.Image:
//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;
Dim image As GleamTech.Drawing.Image
Dim sisImage As Object = SixLabors.ImageSharp.Image.Load("Test.jpg")
'Casting from SixLabors.ImageSharp.Image:
'Use extension method ToGleamTechDrawingImage
image = sisImage.ToGleamTechDrawingImage()
'Or use explicit casting
image = CType(sisImage, GleamTech.Drawing.Image)
'Casting to SixLabors.ImageSharp.Image:
'Use extension method ToImageSharpImage
sisImage = image.ToImageSharpImage()
'Or use explicit casting
sisImage = CType(image, SixLabors.ImageSharp.Image)
Casting from/to SkiaSharp.SKBitmap and SkiaSharp.SKImage:
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;
Dim image As GleamTech.Drawing.Image
Dim skBitmap As Object = SkiaSharp.SKBitmap.Decode("Test.bmp")
Dim skImage As Object = SkiaSharp.SKImage.FromBitmap(skBitmap)
'Casting from SkiaSharp.SKBitmap:
'Use extension method ToGleamTechDrawingImage
image = skBitmap.ToGleamTechDrawingImage()
'Or use explicit casting
image = CType(skBitmap, GleamTech.Drawing.Image)
'Casting to SkiaSharp.SKBitmap:
'Use extension method ToSkiaSharpBitmap
skBitmap = image.ToSkiaSharpBitmap()
'Or use explicit casting
skBitmap = CType(image, SkiaSharp.SKBitmap)
'---------------------------------------
'Casting from SkiaSharp.SKImage:
'Use extension method ToGleamTechDrawingImage
image = skImage.ToGleamTechDrawingImage()
'Or use explicit casting
image = CType(skImage, GleamTech.Drawing.Image)
'Casting to SkiaSharp.SKImage:
'Use extension method ToSkiaSharpImage
skImage = image.ToSkiaSharpImage()
'Or use explicit casting
skImage = CType(image, SkiaSharp.SKImage)
Casting from/to Microsoft.Maui.Graphics.Platform.PlatformImage:
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;
Dim image As GleamTech.Drawing.Image
Dim mgImage As 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 = CType(mgImage, GleamTech.Drawing.Image)
'Casting to Microsoft.Maui.Graphics.Platform.PlatformImage:
'Use extension method ToMauiGraphicsImage
mgImage = image.ToMauiGraphicsImage()
'Or use explicit casting
mgImage = CType(image, Microsoft.Maui.Graphics.Platform.PlatformImage)