Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Microsoft.ML.ImageAnalytics/ImageLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ private Delegate MakeGetterImageDataViewType(DataViewRow input, int iinfo, Func<
if (!string.IsNullOrWhiteSpace(_parent.ImageFolder))
path = Path.Combine(_parent.ImageFolder, path);

dst = new Bitmap(path) { Tag = path };
// to avoid locking file, use the construct below to load bitmap
using(var bmpTemp = new Bitmap(path))
dst = new Bitmap(bmpTemp) { Tag = path };

// Check for an incorrect pixel format which indicates the loading failed
if (dst.PixelFormat == System.Drawing.Imaging.PixelFormat.DontCare)
Expand Down