I’m new to C# and I’m trying to open multiple images to an array to later manipulate their pixels, this is my code so far:
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "Image Files(*.jpg; *.jpeg; *.bmp)|*.jpg; *.jpeg; *.bmp";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
Bitmap[] images = new Bitmap(openFileDialog1.FileNames);
MessageBox.Show(images.Length+" images loaded","",MessageBoxButtons.OK);
}
}
I’m getting problems with this line
Bitmap[] images = new Bitmap(openFileDialog1.FileNames);
Can you help me?
Use:
Because openFileDialog1.FileNames is array of strings and Bitmap constructor expects single image file name