diff --git a/ShareX.HelpersLib/Forms/ImageViewer.cs b/ShareX.HelpersLib/Forms/ImageViewer.cs index a2655d7bd..d01ab3585 100644 --- a/ShareX.HelpersLib/Forms/ImageViewer.cs +++ b/ShareX.HelpersLib/Forms/ImageViewer.cs @@ -56,11 +56,11 @@ public static void ShowImage(Image img) public static void ShowImage(string filePath) { - using (Image img = ImageHelpers.LoadImage(filePath)) + using (Bitmap bmp = ImageHelpers.LoadImage(filePath)) { - if (img != null) + if (bmp != null) { - using (ImageViewer viewer = new ImageViewer(img)) + using (ImageViewer viewer = new ImageViewer(bmp)) { viewer.ShowDialog(); } diff --git a/ShareX.HelpersLib/GIF/AnimatedGifCreator.cs b/ShareX.HelpersLib/GIF/AnimatedGifCreator.cs index c598711f0..e74e3a43f 100644 --- a/ShareX.HelpersLib/GIF/AnimatedGifCreator.cs +++ b/ShareX.HelpersLib/GIF/AnimatedGifCreator.cs @@ -68,9 +68,9 @@ public void AddFrame(Image img, GIFQuality quality = GIFQuality.Default) public void AddFrame(string path, GIFQuality quality = GIFQuality.Default) { - using (Image img = ImageHelpers.LoadImage(path)) + using (Bitmap bmp = ImageHelpers.LoadImage(path)) { - AddFrame(img, quality); + AddFrame(bmp, quality); } } diff --git a/ShareX.HelpersLib/Helpers/ClipboardHelpers.cs b/ShareX.HelpersLib/Helpers/ClipboardHelpers.cs index 2b91797a1..3ce6490c7 100644 --- a/ShareX.HelpersLib/Helpers/ClipboardHelpers.cs +++ b/ShareX.HelpersLib/Helpers/ClipboardHelpers.cs @@ -203,9 +203,9 @@ public static bool CopyImageFromFile(string path) { try { - using (Image img = ImageHelpers.LoadImage(path)) + using (Bitmap bmp = ImageHelpers.LoadImage(path)) { - return CopyImage(img); + return CopyImage(bmp); } } catch (Exception e) diff --git a/ShareX.HelpersLib/Helpers/ImageHelpers.cs b/ShareX.HelpersLib/Helpers/ImageHelpers.cs index 037a45368..2a79a129f 100644 --- a/ShareX.HelpersLib/Helpers/ImageHelpers.cs +++ b/ShareX.HelpersLib/Helpers/ImageHelpers.cs @@ -87,34 +87,34 @@ public static Bitmap ResizeImageByPercentage(Bitmap bmp, float percentage, Inter return ResizeImageByPercentage(bmp, percentage, percentage, interpolationMode); } - public static Image ResizeImage(Image img, Size size, bool allowEnlarge, bool centerImage = true) + public static Bitmap ResizeImage(Bitmap bmp, Size size, bool allowEnlarge, bool centerImage = true) { - return ResizeImage(img, size.Width, size.Height, allowEnlarge, centerImage); + return ResizeImage(bmp, size.Width, size.Height, allowEnlarge, centerImage); } - public static Image ResizeImage(Image img, int width, int height, bool allowEnlarge, bool centerImage = true) + public static Bitmap ResizeImage(Bitmap bmp, int width, int height, bool allowEnlarge, bool centerImage = true) { - return ResizeImage(img, width, height, allowEnlarge, centerImage, Color.Transparent); + return ResizeImage(bmp, width, height, allowEnlarge, centerImage, Color.Transparent); } - public static Image ResizeImage(Image img, int width, int height, bool allowEnlarge, bool centerImage, Color backColor) + public static Bitmap ResizeImage(Bitmap bmp, int width, int height, bool allowEnlarge, bool centerImage, Color backColor) { double ratio; int newWidth, newHeight; - if (!allowEnlarge && img.Width <= width && img.Height <= height) + if (!allowEnlarge && bmp.Width <= width && bmp.Height <= height) { ratio = 1.0; - newWidth = img.Width; - newHeight = img.Height; + newWidth = bmp.Width; + newHeight = bmp.Height; } else { - double ratioX = (double)width / img.Width; - double ratioY = (double)height / img.Height; + double ratioX = (double)width / bmp.Width; + double ratioY = (double)height / bmp.Height; ratio = ratioX < ratioY ? ratioX : ratioY; - newWidth = (int)(img.Width * ratio); - newHeight = (int)(img.Height * ratio); + newWidth = (int)(bmp.Width * ratio); + newHeight = (int)(bmp.Height * ratio); } int newX = 0; @@ -122,14 +122,14 @@ public static Image ResizeImage(Image img, int width, int height, bool allowEnla if (centerImage) { - newX += (int)((width - (img.Width * ratio)) / 2); - newY += (int)((height - (img.Height * ratio)) / 2); + newX += (int)((width - (bmp.Width * ratio)) / 2); + newY += (int)((height - (bmp.Height * ratio)) / 2); } - Bitmap bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb); - bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution); + Bitmap bmpResult = new Bitmap(width, height, PixelFormat.Format32bppArgb); + bmpResult.SetResolution(bmp.HorizontalResolution, bmp.VerticalResolution); - using (Graphics g = Graphics.FromImage(bmp)) + using (Graphics g = Graphics.FromImage(bmpResult)) { if (backColor.A > 0) { @@ -137,15 +137,15 @@ public static Image ResizeImage(Image img, int width, int height, bool allowEnla } g.SetHighQuality(); - g.DrawImage(img, newX, newY, newWidth, newHeight); + g.DrawImage(bmp, newX, newY, newWidth, newHeight); } - return bmp; + return bmpResult; } - public static Image CreateThumbnail(Image img, int width, int height) + public static Bitmap CreateThumbnail(Bitmap bmp, int width, int height) { - double srcRatio = (double)img.Width / img.Height; + double srcRatio = (double)bmp.Width / bmp.Height; double dstRatio = (double)width / height; int w, h; @@ -153,42 +153,42 @@ public static Image CreateThumbnail(Image img, int width, int height) { if (srcRatio >= 1) { - w = (int)(img.Height * dstRatio); + w = (int)(bmp.Height * dstRatio); } else { - w = (int)(img.Width / srcRatio * dstRatio); + w = (int)(bmp.Width / srcRatio * dstRatio); } - h = img.Height; + h = bmp.Height; } else { - w = img.Width; + w = bmp.Width; if (srcRatio >= 1) { - h = (int)(img.Height / dstRatio * srcRatio); + h = (int)(bmp.Height / dstRatio * srcRatio); } else { - h = (int)(img.Height * srcRatio / dstRatio); + h = (int)(bmp.Height * srcRatio / dstRatio); } } - int x = (img.Width - w) / 2; - int y = (img.Height - h) / 2; + int x = (bmp.Width - w) / 2; + int y = (bmp.Height - h) / 2; - Bitmap bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb); - bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution); + Bitmap bmpResult = new Bitmap(width, height, PixelFormat.Format32bppArgb); + bmpResult.SetResolution(bmp.HorizontalResolution, bmp.VerticalResolution); - using (Graphics g = Graphics.FromImage(bmp)) + using (Graphics g = Graphics.FromImage(bmpResult)) { g.SetHighQuality(); - g.DrawImage(img, new Rectangle(0, 0, width, height), new Rectangle(x, y, w, h), GraphicsUnit.Pixel); + g.DrawImage(bmp, new Rectangle(0, 0, width, height), new Rectangle(x, y, w, h), GraphicsUnit.Pixel); } - return bmp; + return bmpResult; } /// If image size is bigger than specified size then resize it and keep aspect ratio else return image. @@ -750,17 +750,17 @@ public static Bitmap DrawCheckers(int width, int height, int checkerSize, Color return bmp; } - public static Image CreateCheckerPattern() + public static Bitmap CreateCheckerPattern() { return CreateCheckerPattern(10, 10); } - public static Image CreateCheckerPattern(int width, int height) + public static Bitmap CreateCheckerPattern(int width, int height) { return CreateCheckerPattern(width, height, SystemColors.ControlLight, SystemColors.ControlLightLight); } - public static Image CreateCheckerPattern(int width, int height, Color checkerColor1, Color checkerColor2) + public static Bitmap CreateCheckerPattern(int width, int height, Color checkerColor1, Color checkerColor2) { Bitmap bmp = new Bitmap(width * 2, height * 2); @@ -1715,7 +1715,7 @@ public static Bitmap LoadImage(string filePath) return null; } - public static Image LoadImageWithFileDialog() + public static Bitmap LoadImageWithFileDialog() { string filepath = OpenImageFileDialog(); @@ -1727,7 +1727,7 @@ public static Image LoadImageWithFileDialog() return null; } - public static Image CombineImages(IEnumerable images, Orientation orientation = Orientation.Vertical, int space = 0) + public static Bitmap CombineImages(IEnumerable images, Orientation orientation = Orientation.Vertical, int space = 0) { int width, height; @@ -1773,9 +1773,9 @@ public static Image CombineImages(IEnumerable images, Orientation orienta return bmp; } - public static List SplitImage(Image img, int rowCount, int columnCount) + public static List SplitImage(Image img, int rowCount, int columnCount) { - List images = new List(); + List images = new List(); int width = img.Width / columnCount; int height = img.Height / rowCount; @@ -1800,7 +1800,7 @@ public static List SplitImage(Image img, int rowCount, int columnCount) return images; } - public static Image CreateColorPickerIcon(Color color, Rectangle rect, int holeSize = 0) + public static Bitmap CreateColorPickerIcon(Color color, Rectangle rect, int holeSize = 0) { Bitmap bmp = new Bitmap(rect.Width, rect.Height); @@ -2039,11 +2039,11 @@ public static void SelectiveColor(Bitmap bmp, Color lightColor, Color darkColor, public static Size GetImageFileDimensions(string filePath) { - using (Image img = LoadImage(filePath)) + using (Bitmap bmp = LoadImage(filePath)) { - if (img != null) + if (bmp != null) { - return img.Size; + return bmp.Size; } } diff --git a/ShareX.HelpersLib/ImageFilesCache.cs b/ShareX.HelpersLib/ImageFilesCache.cs index d00cd4c3c..383ed9996 100644 --- a/ShareX.HelpersLib/ImageFilesCache.cs +++ b/ShareX.HelpersLib/ImageFilesCache.cs @@ -31,23 +31,23 @@ namespace ShareX.HelpersLib { public class ImageFilesCache : IDisposable { - private Dictionary images = new Dictionary(); + private Dictionary images = new Dictionary(); - public Image GetImage(string filePath) + public Bitmap GetImage(string filePath) { if (images.ContainsKey(filePath)) { return images[filePath]; } - Image img = ImageHelpers.LoadImage(filePath); + Bitmap bmp = ImageHelpers.LoadImage(filePath); - if (img != null) + if (bmp != null) { - images.Add(filePath, img); + images.Add(filePath, bmp); } - return img; + return bmp; } public void Clear() @@ -64,11 +64,11 @@ public void Dispose() { if (images != null) { - foreach (Image img in images.Values) + foreach (Bitmap bmp in images.Values) { - if (img != null) + if (bmp != null) { - img.Dispose(); + bmp.Dispose(); } } } diff --git a/ShareX.ImageEffectsLib/Drawings/DrawImage.cs b/ShareX.ImageEffectsLib/Drawings/DrawImage.cs index 900609757..f6ac5046b 100644 --- a/ShareX.ImageEffectsLib/Drawings/DrawImage.cs +++ b/ShareX.ImageEffectsLib/Drawings/DrawImage.cs @@ -61,12 +61,12 @@ public override Bitmap Apply(Bitmap bmp) { if (!string.IsNullOrEmpty(ImageLocation) && File.Exists(ImageLocation)) { - using (Image img = ImageHelpers.LoadImage(ImageLocation)) + using (Bitmap bmp2 = ImageHelpers.LoadImage(ImageLocation)) { - if (img != null) + if (bmp2 != null) { // Calculate size first - Size imageSize = img.Size; + Size imageSize = bmp2.Size; if (SizeMode == DrawImageSizeMode.AbsoluteSize) { // Use Size property @@ -75,7 +75,7 @@ public override Bitmap Apply(Bitmap bmp) else if (SizeMode == DrawImageSizeMode.PercentageOfWatermark) { // Relative size (percentage of watermark) - imageSize = new Size((int)(img.Width * (Size.Width / 100.0)), (int)(img.Height * (Size.Height / 100.0))); + imageSize = new Size((int)(bmp2.Width * (Size.Width / 100.0)), (int)(bmp2.Height * (Size.Height / 100.0))); } else if (SizeMode == DrawImageSizeMode.PercentageOfCanvas) { @@ -96,7 +96,7 @@ public override Bitmap Apply(Bitmap bmp) using (Graphics g = Graphics.FromImage(bmp)) { g.SetHighQuality(); - g.DrawImage(img, imageRectangle); + g.DrawImage(bmp2, imageRectangle); } } } diff --git a/ShareX.ImageEffectsLib/Drawings/DrawParticles.cs b/ShareX.ImageEffectsLib/Drawings/DrawParticles.cs index 677afee83..c90a9d192 100644 --- a/ShareX.ImageEffectsLib/Drawings/DrawParticles.cs +++ b/ShareX.ImageEffectsLib/Drawings/DrawParticles.cs @@ -118,11 +118,11 @@ public override Bitmap Apply(Bitmap bmp) { string file = MathHelpers.RandomPick(files); - Image img = imageCache.GetImage(file); + Bitmap bmpCached = imageCache.GetImage(file); - if (img != null) + if (bmpCached != null) { - DrawImage(bmp, img, g); + DrawImage(bmp, bmpCached, g); } } } diff --git a/ShareX.ImageEffectsLib/ImageEffectPreset.cs b/ShareX.ImageEffectsLib/ImageEffectPreset.cs index b5ce269ad..0784a4be3 100644 --- a/ShareX.ImageEffectsLib/ImageEffectPreset.cs +++ b/ShareX.ImageEffectsLib/ImageEffectPreset.cs @@ -47,7 +47,7 @@ public Bitmap ApplyEffects(Bitmap bmp) { foreach (ImageEffect effect in Effects.Where(x => x.Enabled)) { - result = (Bitmap)effect.Apply(result); + result = effect.Apply(result); if (result == null) { diff --git a/ShareX.ImageEffectsLib/ImageEffectsForm.cs b/ShareX.ImageEffectsLib/ImageEffectsForm.cs index 48242a2a3..c2f7cd1c7 100644 --- a/ShareX.ImageEffectsLib/ImageEffectsForm.cs +++ b/ShareX.ImageEffectsLib/ImageEffectsForm.cs @@ -606,7 +606,7 @@ private void tsmiLoadImageFromFile_Click(object sender, EventArgs e) if (!string.IsNullOrEmpty(filePath)) { if (PreviewImage != null) PreviewImage.Dispose(); - PreviewImage = (Bitmap)ImageHelpers.LoadImage(filePath); + PreviewImage = ImageHelpers.LoadImage(filePath); FilePath = filePath; UpdatePreview(); } @@ -680,7 +680,7 @@ private void pbResult_DragDrop(object sender, DragEventArgs e) if (Helpers.IsImageFile(files[0])) { if (PreviewImage != null) PreviewImage.Dispose(); - PreviewImage = (Bitmap)ImageHelpers.LoadImage(files[0]); + PreviewImage = ImageHelpers.LoadImage(files[0]); UpdatePreview(); } } diff --git a/ShareX.MediaLib/Forms/ImageCombinerForm.cs b/ShareX.MediaLib/Forms/ImageCombinerForm.cs index 0f66bdfd0..a5bf9b4ab 100644 --- a/ShareX.MediaLib/Forms/ImageCombinerForm.cs +++ b/ShareX.MediaLib/Forms/ImageCombinerForm.cs @@ -115,7 +115,7 @@ private void btnCombine_Click(object sender, EventArgs e) { if (lvImages.Items.Count > 0) { - List images = new List(); + List images = new List(); try { @@ -125,11 +125,11 @@ private void btnCombine_Click(object sender, EventArgs e) if (File.Exists(filePath)) { - Image img = ImageHelpers.LoadImage(filePath); + Bitmap bmp = ImageHelpers.LoadImage(filePath); - if (img != null) + if (bmp != null) { - images.Add(img); + images.Add(bmp); } } } @@ -150,7 +150,7 @@ private void btnCombine_Click(object sender, EventArgs e) { if (images != null) { - foreach (Image image in images) + foreach (Bitmap image in images) { if (image != null) { diff --git a/ShareX.MediaLib/Forms/ImageSplitterForm.cs b/ShareX.MediaLib/Forms/ImageSplitterForm.cs index cf48a305a..6b8cf01cf 100644 --- a/ShareX.MediaLib/Forms/ImageSplitterForm.cs +++ b/ShareX.MediaLib/Forms/ImageSplitterForm.cs @@ -57,11 +57,11 @@ private List SplitImage(string filePath, int rowCount, int columnCount, { List filePaths = new List(); - Image img = ImageHelpers.LoadImage(filePath); + Bitmap bmp = ImageHelpers.LoadImage(filePath); - if (img != null) + if (bmp != null) { - List images = ImageHelpers.SplitImage(img, rowCount, columnCount); + List images = ImageHelpers.SplitImage(bmp, rowCount, columnCount); string originalFileName = Path.GetFileNameWithoutExtension(filePath); diff --git a/ShareX.MediaLib/Forms/ImageThumbnailerForm.cs b/ShareX.MediaLib/Forms/ImageThumbnailerForm.cs index b17e1afce..52e410df4 100644 --- a/ShareX.MediaLib/Forms/ImageThumbnailerForm.cs +++ b/ShareX.MediaLib/Forms/ImageThumbnailerForm.cs @@ -166,11 +166,11 @@ private void btnGenerate_Click(object sender, EventArgs e) if (File.Exists(filePath)) { - using (Image img = ImageHelpers.LoadImage(filePath)) + using (Bitmap bmp = ImageHelpers.LoadImage(filePath)) { - if (img != null) + if (bmp != null) { - using (Image thumbnail = ImageHelpers.CreateThumbnail(img, width, height)) + using (Bitmap thumbnail = ImageHelpers.CreateThumbnail(bmp, width, height)) { string filename = Path.GetFileNameWithoutExtension(filePath); string outputPath = Path.Combine(outputFolder, outputFilename.Replace("$filename", filename)); diff --git a/ShareX.ScreenCaptureLib/Forms/EditorStartupForm.cs b/ShareX.ScreenCaptureLib/Forms/EditorStartupForm.cs index 85e93324e..b68edaa49 100644 --- a/ShareX.ScreenCaptureLib/Forms/EditorStartupForm.cs +++ b/ShareX.ScreenCaptureLib/Forms/EditorStartupForm.cs @@ -50,7 +50,7 @@ private void LoadImageFile(string imageFilePath) { if (!string.IsNullOrEmpty(imageFilePath)) { - Image = (Bitmap)ImageHelpers.LoadImage(imageFilePath); + Image = ImageHelpers.LoadImage(imageFilePath); if (Image != null) { diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/ImageFileDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/ImageFileDrawingShape.cs index 4a506276c..1b40476e8 100644 --- a/ShareX.ScreenCaptureLib/Shapes/Drawing/ImageFileDrawingShape.cs +++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/ImageFileDrawingShape.cs @@ -69,13 +69,13 @@ private bool LoadImageFile(string filePath, bool centerImage) { if (!string.IsNullOrEmpty(filePath)) { - Image img = ImageHelpers.LoadImage(filePath); + Bitmap bmp = ImageHelpers.LoadImage(filePath); - if (img != null) + if (bmp != null) { AnnotationOptions.LastImageFilePath = filePath; - SetImage(img, centerImage); + SetImage(bmp, centerImage); return true; } diff --git a/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs b/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs index d554aecea..99d869e33 100644 --- a/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs +++ b/ShareX.ScreenCaptureLib/Shapes/ShapeManager.cs @@ -1608,8 +1608,8 @@ private void PasteFromClipboard(bool insertMousePosition) if (!string.IsNullOrEmpty(imageFilePath)) { - Image img = ImageHelpers.LoadImage(imageFilePath); - InsertImage(img); + Bitmap bmp = ImageHelpers.LoadImage(imageFilePath); + InsertImage(bmp); } } } @@ -1758,7 +1758,7 @@ private void LoadImageFile(string filePath) { if (!string.IsNullOrEmpty(filePath)) { - Bitmap bmp = (Bitmap)ImageHelpers.LoadImage(filePath); + Bitmap bmp = ImageHelpers.LoadImage(filePath); if (bmp != null) { @@ -1780,8 +1780,8 @@ private void InsertImageFile() if (!string.IsNullOrEmpty(filePath)) { - Image img = ImageHelpers.LoadImage(filePath); - InsertImage(img); + Bitmap bmp = ImageHelpers.LoadImage(filePath); + InsertImage(bmp); } } @@ -1865,7 +1865,7 @@ private void ChangeImageSize() if (size != oldSize) { InterpolationMode interpolationMode = GetInterpolationMode(Options.ImageEditorResizeInterpolationMode); - Bitmap bmp = (Bitmap)ImageHelpers.ResizeImage(Form.Canvas, size, interpolationMode); + Bitmap bmp = ImageHelpers.ResizeImage(Form.Canvas, size, interpolationMode); if (bmp != null) { diff --git a/ShareX/Controls/TaskThumbnailPanel.cs b/ShareX/Controls/TaskThumbnailPanel.cs index f39a9ffc4..9edb98b3b 100644 --- a/ShareX/Controls/TaskThumbnailPanel.cs +++ b/ShareX/Controls/TaskThumbnailPanel.cs @@ -307,7 +307,7 @@ private void UpdateLayout() } } - public void UpdateThumbnail(Image image = null) + public void UpdateThumbnail(Bitmap bmp = null) { ClearThumbnail(); @@ -323,11 +323,11 @@ public void UpdateThumbnail(Image image = null) pbThumbnail.Cursor = Cursors.Hand; } - Image img = CreateThumbnail(filePath, image); + Bitmap bmpResult = CreateThumbnail(filePath, bmp); - if (img != null) + if (bmpResult != null) { - pbThumbnail.Image = img; + pbThumbnail.Image = bmpResult; ThumbnailExists = true; } @@ -339,11 +339,11 @@ public void UpdateThumbnail(Image image = null) } } - private Image CreateThumbnail(string filePath, Image image = null) + private Bitmap CreateThumbnail(string filePath, Bitmap bmp = null) { - if (image != null) + if (bmp != null) { - return ImageHelpers.ResizeImage(image, ThumbnailSize, false); + return ImageHelpers.ResizeImage(bmp, ThumbnailSize, false); } else { @@ -353,11 +353,11 @@ private Image CreateThumbnail(string filePath, Image image = null) } else if (File.Exists(filePath)) { - using (Image img = ImageHelpers.LoadImage(filePath)) + using (Bitmap bmpResult = ImageHelpers.LoadImage(filePath)) { - if (img != null) + if (bmpResult != null) { - return ImageHelpers.ResizeImage(img, ThumbnailSize, false); + return ImageHelpers.ResizeImage(bmpResult, ThumbnailSize, false); } } } @@ -365,9 +365,9 @@ private Image CreateThumbnail(string filePath, Image image = null) if (!string.IsNullOrEmpty(filePath)) { using (Icon icon = NativeMethods.GetJumboFileIcon(filePath, false)) - using (Image img = icon.ToBitmap()) + using (Bitmap bmpResult = icon.ToBitmap()) { - return ImageHelpers.ResizeImage(img, ThumbnailSize, false, true); + return ImageHelpers.ResizeImage(bmpResult, ThumbnailSize, false, true); } } } diff --git a/ShareX/Forms/QRCodeForm.cs b/ShareX/Forms/QRCodeForm.cs index a57a3897e..9f4607410 100644 --- a/ShareX/Forms/QRCodeForm.cs +++ b/ShareX/Forms/QRCodeForm.cs @@ -122,11 +122,11 @@ private void DecodeFromFile(string filePath) { if (!string.IsNullOrEmpty(filePath)) { - using (Image img = ImageHelpers.LoadImage(filePath)) + using (Bitmap bmp = ImageHelpers.LoadImage(filePath)) { - if (img != null) + if (bmp != null) { - DecodeImage((Bitmap)img); + DecodeImage(bmp); } } } diff --git a/ShareX/TaskHelpers.cs b/ShareX/TaskHelpers.cs index 8660d53d8..9ff58762c 100644 --- a/ShareX/TaskHelpers.cs +++ b/ShareX/TaskHelpers.cs @@ -903,7 +903,7 @@ public static void AnnotateImageFromFile(string filePath, TaskSettings taskSetti { if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings(); - Bitmap bmp = (Bitmap)ImageHelpers.LoadImage(filePath); + Bitmap bmp = ImageHelpers.LoadImage(filePath); AnnotateImageAsync(bmp, filePath, taskSettings); } @@ -1031,7 +1031,7 @@ public static void OpenImageEffects(TaskSettings taskSettings = null) if (!string.IsNullOrEmpty(filePath)) { - Bitmap bmp = (Bitmap)ImageHelpers.LoadImage(filePath); + Bitmap bmp = ImageHelpers.LoadImage(filePath); if (bmp != null) { diff --git a/ShareX/TaskManager.cs b/ShareX/TaskManager.cs index f2b8c7f3e..7ece41fef 100644 --- a/ShareX/TaskManager.cs +++ b/ShareX/TaskManager.cs @@ -158,7 +158,7 @@ private static void Task_ImageReady(WorkerTask task, Image image) if (Program.Settings.TaskViewMode == TaskViewMode.ThumbnailView) { - panel.UpdateThumbnail(image); + panel.UpdateThumbnail((Bitmap)image); } } }