Click here to Skip to main content
15,880,796 members
Articles / Programming Languages / C#

Get a bitmap from an AVI file

Rate me:
Please Sign up or sign in to vote.
2.28/5 (13 votes)
2 May 2006CPOL 61.1K   2.5K   19   11
A simple idea about getting a bitmap from an AVI file.

Sample Image - Get_bitmap_from_AVI_file.jpg

Introduction

Many articles have discussed how to get a bitmap from an AVI file. So this article can only give the first concept to those have no idea of the AVI API, just as what I was a few weeks ago. This application adds some feathers; these include: adjusting the ratio of a bitmap to a certain value, such as a change from 16:9 to 4:3, adding a caption at the top of a bitmap etc.

Using the code

The function GetBitmap is from Corinna John's article, you can read it for more details. To get the bitmap from an AVI file:

C#
Bitmap bmp = AviBase.GetBitmap(txtFileName.Text, Convert.ToInt32(numPosition.Value));

here is how you adjust the format of the bitmap:

C#
FormatBitmap f = new FormatBitmap();
f.m_nCaptionFontHeight = (int)numFontSize.Value;
f.m_nCaptionFontLeftSpace = (int)numLeftSpace.Value;
            
Bitmap bmp1 = f.GetFormattedBitmap(bmp, textCaption.Lines);

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionFrames Pin
Pedrum Sd26-May-12 17:03
Pedrum Sd26-May-12 17:03 
QuestionGetBitmap returns empty bitmap Pin
THEAniKan30-Apr-10 14:45
THEAniKan30-Apr-10 14:45 
GeneralExport Image problem Pin
tdinpsp13-Oct-09 7:33
tdinpsp13-Oct-09 7:33 
Generalbitmap is shifted with round robin fashion for an AVI file. Pin
prakash Invent24-Feb-09 2:25
prakash Invent24-Feb-09 2:25 
GeneralSome speed improvements Pin
Georgi Petrov23-Jun-06 4:00
Georgi Petrov23-Jun-06 4:00 
GeneralAVI file frame count Pin
Georgi Petrov15-Jun-06 13:16
Georgi Petrov15-Jun-06 13:16 
GeneralRe: AVI file frame count Pin
Denny5015-Jun-06 14:31
Denny5015-Jun-06 14:31 
GeneralRe: AVI file frame count Pin
Georgi Petrov15-Jun-06 21:22
Georgi Petrov15-Jun-06 21:22 
Thank you!!!
This is very easy to implement, great Smile | :) )
GeneralRe: AVI file frame count Pin
electriac29-May-10 5:21
electriac29-May-10 5:21 
Generalproblem with long files Pin
ludwig boltzmann17-May-06 3:13
ludwig boltzmann17-May-06 3:13 
GeneralRe: problem with long files Pin
ludwig boltzmann29-May-06 21:43
ludwig boltzmann29-May-06 21:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.