Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 657915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:52:35+00:00 2026-05-13T22:52:35+00:00

i found some articles, some projects to create thumbnail of a video, using ffmpeg.exe,

  • 0

i found some articles, some projects to create thumbnail of a video, using ffmpeg.exe, expression encoder
but when i downloaded the projects they are not working…
i am not getting that weather ffmpeg.exe downloaded by having problem or the projects are not working.

if anybody has other sources from where i can see samples. please post it..

-thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:52:35+00:00Added an answer on May 13, 2026 at 10:52 pm

    Here is the class to make thumbnail of
    either video or mage using ffmpeg.exe

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Drawing.Imaging;
    namespace Pariwaar.Controller
    {
        public class imageResize
        {
    
            public byte[] ResizeFromByteArray(int MaxSideSize, Byte[] byteArrayIn, string fileName)
            {
                byte[] byteArray = null;  // really make this an error gif
                MemoryStream ms = new MemoryStream(byteArrayIn);
                byteArray = this.ResizeFromStream(MaxSideSize, ms, fileName);
    
                return byteArray;
            }
    
            /// <summary>
            /// converts stream to bytearray for resized image
            /// </summary>
            /// <param name="MaxSideSize"></param>
            /// <param name="Buffer"></param>
            /// <returns></returns>
            public byte[] ResizeFromStream(int MaxSideSize, Stream Buffer, string fileName)
            {
                byte[] byteArray = null;  // really make this an error gif
    
                try
                {
    
                    Bitmap bitMap = new Bitmap(Buffer);
                    int intOldWidth = bitMap.Width;
                    int intOldHeight = bitMap.Height;
    
                    int intNewWidth;
                    int intNewHeight;
    
                    int intMaxSide;
    
                    if (intOldWidth >= intOldHeight)
                    {
                        intMaxSide = intOldWidth;
                    }
                    else
                    {
                        intMaxSide = intOldHeight;
                    }
    
                    if (intMaxSide > MaxSideSize)
                    {
                        //set new width and height
                        double dblCoef = MaxSideSize / (double)intMaxSide;
                        intNewWidth = Convert.ToInt32(dblCoef * intOldWidth);
                        intNewHeight = Convert.ToInt32(dblCoef * intOldHeight);
                    }
                    else
                    {
                        intNewWidth = intOldWidth;
                        intNewHeight = intOldHeight;
                    }
    
                    Size ThumbNailSize = new Size(intNewWidth, intNewHeight);
                    System.Drawing.Image oImg = System.Drawing.Image.FromStream(Buffer);
                    System.Drawing.Image oThumbNail = new Bitmap(ThumbNailSize.Width, ThumbNailSize.Height);
    
                    Graphics oGraphic = Graphics.FromImage(oThumbNail);
                    oGraphic.CompositingQuality = CompositingQuality.HighQuality;
                    oGraphic.SmoothingMode = SmoothingMode.HighQuality;
                    oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    Rectangle oRectangle = new Rectangle
                        (0, 0, ThumbNailSize.Width, ThumbNailSize.Height);
    
                    oGraphic.DrawImage(oImg, oRectangle);
    
                    MemoryStream ms = new MemoryStream();
                    oThumbNail.Save(ms, ImageFormat.Jpeg);
                    byteArray = new byte[ms.Length];
                    ms.Position = 0;
                    ms.Read(byteArray, 0, Convert.ToInt32(ms.Length));
    
                    oGraphic.Dispose();
                    oImg.Dispose();
                    ms.Close();
                    ms.Dispose();
                }
                catch (Exception)
                {
                    int newSize = MaxSideSize - 20;
                    Bitmap bitMap = new Bitmap(newSize, newSize);
                    Graphics g = Graphics.FromImage(bitMap);
                    g.FillRectangle(new SolidBrush(Color.Gray), new Rectangle(0, 0, newSize, newSize));
    
                    Font font = new Font("Courier", 8);
                    SolidBrush solidBrush = new SolidBrush(Color.Red);
                    g.DrawString("Failed File", font, solidBrush, 10, 5);
                    g.DrawString(fileName, font, solidBrush, 10, 50);
    
                    MemoryStream ms = new MemoryStream();
                    bitMap.Save(ms, ImageFormat.Jpeg);
                    byteArray = new byte[ms.Length];
                    ms.Position = 0;
                    ms.Read(byteArray, 0, Convert.ToInt32(ms.Length));
    
                    ms.Close();
                    ms.Dispose();
                    bitMap.Dispose();
                    solidBrush.Dispose();
                    g.Dispose();
                    font.Dispose();
    
                }
                return byteArray;
            }
    
            /// <summary>
            /// Saves the resized image to specified file name and path as JPEG
            /// and also returns the bytearray for any other use you may need it for
            /// </summary>
            /// <param name="MaxSideSize"></param>
            /// <param name="Buffer"></param>
            /// <param name="fileName">No Extension</param>
            /// <param name="filePath">Examples: "images/dir1/dir2" or "images" or "images/dir1"</param>
            /// <returns></returns>
            public byte[] SaveFromStream(int MaxSideSize, Stream Buffer, string ErrorMessage, string filePath, string ThumbnailPath)
            {
                byte[] byteArray = null;  // really make this an error gif
    
                try
                {
    
                    Bitmap bitMap = new Bitmap(Buffer);
                    int intOldWidth = bitMap.Width;
                    int intOldHeight = bitMap.Height;
    
                    int intNewWidth;
                    int intNewHeight;
    
                    int intMaxSide;
    
                    if (intOldWidth >= intOldHeight)
                    {
                        intMaxSide = intOldWidth;
                    }
                    else
                    {
                        intMaxSide = intOldHeight;
                    }
    
                    if (intMaxSide > MaxSideSize)
                    {
                        //set new width and height
                        double dblCoef = MaxSideSize / (double)intMaxSide;
                        intNewWidth = Convert.ToInt32(dblCoef * intOldWidth);
                        intNewHeight = Convert.ToInt32(dblCoef * intOldHeight);
                    }
                    else
                    {
                        intNewWidth = intOldWidth;
                        intNewHeight = intOldHeight;
                    }
    
                    Size ThumbNailSize = new Size(intNewWidth, intNewHeight);
                    System.Drawing.Image oImg = System.Drawing.Image.FromStream(Buffer);
                    System.Drawing.Image oThumbNail = new Bitmap(ThumbNailSize.Width, ThumbNailSize.Height);
    
                    Graphics oGraphic = Graphics.FromImage(oThumbNail);
    
                    oGraphic.CompositingQuality = CompositingQuality.HighQuality;
                    oGraphic.SmoothingMode = SmoothingMode.HighQuality;
                    oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    Rectangle oRectangle = new Rectangle
                        (0, 0, ThumbNailSize.Width, ThumbNailSize.Height);
    
                    oGraphic.DrawImage(oImg, oRectangle);
    
                    //Save File
                    string newFileName = filePath;
                    oThumbNail.Save(newFileName, ImageFormat.Jpeg);
    
                    MemoryStream ms = new MemoryStream();
                    oThumbNail.Save(ms, ImageFormat.Jpeg);
    
                    //--- done by vrunda create thmbnail
                    System.Drawing.Image.GetThumbnailImageAbort dummyCallBack = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
                    System.Drawing.Image thumbNailImg =oThumbNail.GetThumbnailImage(100, 100, dummyCallBack, IntPtr.Zero);
                    thumbNailImg.Save(ThumbnailPath, ImageFormat.Jpeg);
                    //----- done by vrunda
    
                    byteArray = new byte[ms.Length];
                    ms.Position = 0;
                    ms.Read(byteArray, 0, Convert.ToInt32(ms.Length));
    
                    oGraphic.Dispose();
                    oImg.Dispose();
                    ms.Close();
                    ms.Dispose();
                }
                catch (Exception)
                {
                    int newSize = MaxSideSize - 20;
                    Bitmap bitMap = new Bitmap(newSize, newSize);
                    Graphics g = Graphics.FromImage(bitMap);
                    g.FillRectangle(new SolidBrush(Color.Gray), new Rectangle(0, 0, newSize, newSize));
    
                    Font font = new Font("Courier", 8);
                    SolidBrush solidBrush = new SolidBrush(Color.Red);
                    g.DrawString("Failed To Save File or Failed File  ", font, solidBrush, 10, 5);
                    g.DrawString(ErrorMessage, font, solidBrush, 10, 50);
    
                    MemoryStream ms = new MemoryStream();
                    bitMap.Save(ms, ImageFormat.Jpeg);
                    byteArray = new byte[ms.Length];
                    ms.Position = 0;
                    ms.Read(byteArray, 0, Convert.ToInt32(ms.Length));
    
                    ms.Close();
                    ms.Dispose();
                    bitMap.Dispose();
                    solidBrush.Dispose();
                    g.Dispose();
                    font.Dispose();
    
                }
                return byteArray;
            }
            public bool ThumbnailCallback()
            {
                return false;
            }
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found some in the Cappuccino website (vim, textmate and SubEthaEdit), but not
I have found some info on the subject ( like this link) , but
some time ago I found an article ( Roles: Composable Units of Object Behavior
Found some old code, circa VS 2003. Now I have just VS 2008 (SP1)
I found some code in a project which looks like that : int main(int
I have found some libraries or web services in PHP that does the job.
After googling a bit I have found some tips about how to get online
Quick question regarding CSS and the browser. I tried searching SO and found some
I've been parsing through some log files and I've found that some of the
I'm currently working on project with Haskell, and have found myself some trouble. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.