Saving Camera shot and Drawing from picturebox to jpeg

 ̄綄美尐妖づ 提交于 2021-01-29 20:08:49

问题


I watched and applied these video tutorials on my program:

Camera Capture using AForge - https://youtu.be/_1GymNPQ248

Drawing Pad - https://youtu.be/TVPHEIJX-uw

I used picturebox both on them and can't save files using SaveFileDialog.

Using Graphics G = picturebox1.CreateGraphics()is temp (How to draw on a picturebox and save it in Winforms C#?)

I just want to have permanent image of them and save. Hoping you could help me, friends. Here's my code:

    private void xpt_SnS_Click(object sender, EventArgs e)
    {
        SaveFileDialog sav = new SaveFileDialog();`

        if (sav.ShowDialog() == DialogResult.OK)
        {
            picbx_Main.Image = imgCam;
            imgCam.Save(sav.FileName);
        }
    }
    //int w = pan_sign2.Size.Width;
    //int h = pan_sign2.Size.Height;

    //using (Bitmap bmp = new Bitmap(w,h))
    //{
    //    pan_sign2.DrawToBitmap(bmp, new Rectangle(0,0,w,h));
    //    bmp.Save("Test.jpg");
    //}



    //Bitmap bmp = new Bitmap(pan_sign2.Width, pan_sign2.Height);
    //var gg = Graphics.FromImage(bmp);
    //var rect = pan_sign2.RectangleToScreen(pan_sign2.ClientRectangle);
    //gg.CopyFromScreen(rect.Location, System.Drawing.Point.Empty, pan_sign2.Size);

    //System.Diagnostics.Process.Start("Test.jpg");
    //pan_sign2.Image = imgSign;
    //SaveFileDialog sav = new SaveFileDialog();
    //sav.Filter = "JPEG |*.jpg";
    //if (sav.ShowDialog() == DialogResult.OK)
    //{
    //    imgSign.Save(sav.FileName);
    //}

来源:https://stackoverflow.com/questions/65762544/saving-camera-shot-and-drawing-from-picturebox-to-jpeg

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!