1

i have problem in compress images i cant find video talk about compress images,

what i want to create is Screen Recorder, i want to compress images and Audio System but how??

im using visual studio windows forms C#

Thank you for help

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        PictureBox pb = new PictureBox();
        int x;

        private void Form1_Load(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FrameOFSecond.Enabled = true;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            FrameOFSecond.Enabled = false;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            using (SaveFileDialog sfd = new SaveFileDialog())
            {
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    string path = Path.GetFullPath(sfd.FileName);
                    //pb.Image.Save(path);
                }
            }
        }

        void Sanpshot()
        {
            Bitmap bm = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            Graphics g = Graphics.FromImage(bm);
            g.CopyFromScreen(0, 0, 0, 0, bm.Size);
            pb.Image = bm;
            string path;

            if (x == 0)
            {
                path = @"Pictures\" + "Screenshot-1" + ".png";
                x += 2;
            }
            else
            {
                path = @"Pictures\" + "Screenshot-" + x + ".png";
                x += 1;
            }
            try
            {
                pb.Image.Save(path);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }

        private void FrameOFSecond_Tick(object sender, EventArgs e)
        {
            Sanpshot();
        }
    }

FrameOFSecond.Interval = 17. the frame of second 60 in 1s almost

enter image description here

0 Answers0