How can i create a thumbnail from a video binary (bytes[])?
I do not have access to the directories, so i can't save the file and the example that I can see (using ffmpeg) to create a thumbnail is from a path.
Is there another way to do it?
How can i create a thumbnail from a video binary (bytes[])?
I do not have access to the directories, so i can't save the file and the example that I can see (using ffmpeg) to create a thumbnail is from a path.
Is there another way to do it?
Assuming, sampleBytes is our byte[] :
using (MemoryStream ms = new MemoryStream(sampleBytes))
{
Bitmap thumb = new Bitmap(100, 100);
using (Image bmp = Image.FromStream(ms))
{
using (Graphics g = Graphics.FromImage(thumb))
{
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.CompositingQuality = CompositingQuality.HighQuality;
g.SmoothingMode = SmoothingMode.HighQuality;
g.DrawImage(bmp, 0, 0, 100, 100);
}
}
// this can show the result
picBoxOut.Image = thumb;
}