Skip to content
Open
Changes from all commits
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
6 changes: 3 additions & 3 deletions FirstFloor.ModernUI/Windows/Controls/BetterImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ public static Image LoadBitmapSourceFromMemoryStream([NotNull] MemoryStream data
downsized = true;
}

bi.CreateOptions = BitmapCreateOptions.None;
bi.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
bi.CacheOption = BitmapCacheOption.OnLoad;
bi.StreamSource = stream;
bi.EndInit();
Expand Down Expand Up @@ -1336,13 +1336,13 @@ private static unsafe bool FindTransparentCropArea(string tag, BitmapSource b, o
}

int w = b.PixelWidth, h = b.PixelHeight, s = (w * b.Format.BitsPerPixel + 7) / 8;
if (w > 800 || h > 450) {
var data = _transparentCropData.Value;
if ((long)s * h > data.Length) {
Logging.Warning($"Image is too large to crop: {w}×{h}, tag: {tag}");
left = top = right = bottom = 0;
return true;
}

var data = _transparentCropData.Value;
b.CopyPixels(data, s, 0);

var k = b.Format.Masks.ElementAtOrDefault(0).Mask;
Expand Down