Skip to content

Download images only when not present on disk and print warning messages when converting unsupported pixel format. #3625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 1, 2019
Prev Previous commit
Next Next commit
PR feedback.
  • Loading branch information
codemzs committed May 1, 2019
commit b19d63e2f4ad6e2ebbb62a54e2674fbdc37411fe
7 changes: 5 additions & 2 deletions src/Microsoft.ML.ImageAnalytics/ImageLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,13 @@ protected override Delegate MakeGetter(DataViewRow input, int iinfo, Func<int, b
if (!string.IsNullOrWhiteSpace(_parent.ImageFolder))
path = Path.Combine(_parent.ImageFolder, path);

using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read))
MemoryStream inMemoryCopy = new MemoryStream();
using (FileStream fs = File.OpenRead(path))
{
dst = new Bitmap(stream) { Tag = path };
fs.CopyTo(inMemoryCopy);
}

dst = new Bitmap(inMemoryCopy) { Tag = path };
}
catch (Exception)
{
Expand Down