public void LoadImage() { try { Source = new BitmapImage(new Uri(Path)) { CacheOption = BitmapCacheOption.OnLoad }; DebugUtils.LogIO($"Loaded file from <{ID}>"); } catch (Exception e) { DebugUtils.LogError($"Error loading file from <{ID}>. Reason => {e.Message}"); } if (!IsCustom && Source.Width <= 512 && Source.Height <= 512) { try { DarkenedSource = Source.GetAllBlack(); DebugUtils.LogIO($"Loaded shadow for sprite <{ID}>"); } catch (Exception e) { DebugUtils.LogError($"Error loading shadow for sprite <{ID}>. Reason => {e.Message}"); } } else { DebugUtils.LogIO($"Won't load shadow for sprite <{ID}>. The sprite is either custom or too big"); } }