private void SaveImage(FsPath file, FsPath targetdir, ILog log, SKData data, string?extensionOverride) { FsPath target = targetdir.Combine(file.Filename); if (extensionOverride != null) { var newname = Path.ChangeExtension(file.Filename, extensionOverride); target = targetdir.Combine(newname); } using (var stream = target.CreateStream(log)) { log.Detail("Saving image: {0}", target); data.SaveTo(stream); } }