C# Simple Image Resize : File Size Not Shrinking

后端 未结 6 964
夕颜
夕颜 2021-01-03 08:39

I have a question in regards to the code below. The code I have below successfully runs through a directory, and sets the resoultion of the picture to a smaller size. Howe

6条回答
  •  渐次进展
    2021-01-03 09:27

     private void button4_Click(object sender, EventArgs e)
      {
                String[] files;
                int count = 0;
                files = System.IO.Directory.GetFiles(@"C:/dataset");
                foreach (string file in files)
                {
                Bitmap tempBmp = new Bitmap(file);
                Bitmap bmp = new Bitmap(tempBmp, 200, 200);
    
                bmp.Save(
                @"C:/Newdataset1/" + count + ".jpg",
                System.Drawing.Imaging.ImageFormat.Jpeg);
                count++;
                }  
    

    }

提交回复
热议问题