I am trying to display images in pictureboxes in C# windows form. There are many images, say 100s and their average size is about 1 MB. So I want to compress or decrease their size before they are loaded into the picturebox. Now it throws 'outofmemory exception'. Please how can I achieve this? Help me.
My code looks like
List<string> imgPaths = new List<string>();
foreach(string imgName in imgPaths)
{
Image img = Image.FromFile(imgName);
// I want to compress the image, but I don't know how to
PictureBox picBox = new PictureBox();
picBox.Image = imgCompressed;
.....
.....
}