private void button8_Click(object sender, EventArgs e)
{
List<long> averages;
long res = 0;
_fi = new DirectoryInfo(subDirectoryName).GetFiles("*.bmp");
averages = new List<long>(_fi.Length);
for (int i = 0; i < _fi.Length; i++)
{
Bitmap myBitmaps = new Bitmap(_fi[i].Name);
//long[] tt = list_of_histograms[i];
long[] HistogramValues = GetHistogram(myBitmaps);
res = GetTopLumAmount(HistogramValues,1000);
averages.Add(res);
}
}
The exception is on the line:
Bitmap myBitmaps = new Bitmap(_fi[i].Name);
You’re only passing the file name to the
Bitmapconstructor, but you should actually pass the full path to the file using_fi[i].FullName