void Scan() { md = new MediaDetClass(); Image img; md.Filename = fileName; md.CurrentStream = 0; int len = (int)md.StreamLength; EncryptDecryptVedio.FrameRate = md.FrameRate; for (float i = 0.0f; i < len; i = i + interval) { MainForm.counter++; string fBitmapName = storagePath + Path.GetFileNameWithoutExtension(fileName) + "_" + MainForm.counter.ToString(); md.WriteBitmapBits(i, 320, 240, fBitmapName + ".bmp"); img = Image.FromFile(fBitmapName + ".bmp"); img.Save(fBitmapName + ".jpg", ImageFormat.Jpeg); Program.images_name[Program.index_vedio] = fBitmapName; Program.index_vedio++; img.Dispose(); System.IO.File.Delete(fBitmapName + ".bmp"); } }
private static Bitmap generateSceneshotOnDisk(MediaDetClass mediaDet, double position, int width, int height) { //Gen unique Filepath String filename = System.IO.Path.GetTempPath() + System.Guid.NewGuid().ToString(); mediaDet.WriteBitmapBits(position, width, height, filename); Bitmap bmp = new Bitmap(filename); return(bmp); }
/// <summary> /// Creates a bitmap file using MediaDetClass' method WriteBitMapBits /// </summary> /// <param name="md">MediaDetClass object for each video file found previewable </param> /// <param name="storagePath">folder name where bitmap files temporarily stored</param> /// <returns></returns> public string newBitmapPath(MediaDetClass md, string storagePath) { tmpBmpCount++; string fBitmapName = storagePath + tmpBmpName + tmpBmpCount.ToString() + ".bmp"; //fullpath of bitmap file that is to be generated md.WriteBitmapBits(frameNo, 650, 450, fBitmapName); //create the bitmap file return fBitmapName; // returns the newly created bitmap filename to the pictureBox }