Question

I extract 100 frames from video file and i save each frame as (.bmp) but i found that each frame format is PNG not BMP , how can I save sequence of frame (format as BMP not PNG as show in picture)in C# ?

string name;            
for ( int i = 0; i < 100; i++ )
{
    Bitmap videoFrame = video.ReadVideoFrame( );  
    name = (i).ToString().PadLeft(5, '0');
    videoFrame.Save(@"D:\frames\" + name  + ".bmp");
    videoFrame.Dispose( );
}

video.Close( );
MessageBox.Show(" Complete Convert video to sequence of image","Convert");

enter image description here

Was it helpful?

Solution

Use System.Drawing.Imaging.ImageFormat to define the format.

Use this:

videoFrame.Save(@"D:\frames\" + name  + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp);

instead of:

videoFrame.Save(@"D:\frames\" + name  + ".bmp");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top