C# Simple Image Resize : File Size Not Shrinking

后端 未结 6 927
夕颜
夕颜 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:46

    Made a couple changes, the following code reduced file sizes as expected (for me).

    private void Form1_Load(object sender, EventArgs e)
    {
        string[] files = null;
        int count = 0;
        files = System.IO.Directory.GetFiles(@"C:\Users\..\..\ChristmasPicsResized");
        foreach (string file in files)
        {
            Bitmap bmp = new Bitmap( file );
            new Bitmap( bmp, 807, 605 ).Save(
                       @"C:\users\..\..\TempPicHold\Pic" + count.ToString() + ".jpg");
            count++;   
        }
    }
    

    }

提交回复
热议问题