From f077eb39b7d48484380f3978cf1b03fd7ac18f76 Mon Sep 17 00:00:00 2001 From: James South Date: Sat, 18 Apr 2015 00:27:32 +0100 Subject: [PATCH] Fixing broken FastBitmap bug. Former-commit-id: 758dac58be3ee77fc060fbf7eaa6b5ebe704b6aa Former-commit-id: f2c9ffe5d7a61cbc5b500d6e565d1c71ae0adadd Former-commit-id: 98b975796743b89e46d3cd03cea01f29d8ee8d26 --- src/ImageProcessor.Playground/Program.cs | 149 +++++++++--------- .../images/input/tree.jpg.REMOVED.git-id | 1 + .../PostProcessorBootstrapper.cs | 10 +- .../Settings.StyleCop | 8 +- src/ImageProcessor/Imaging/Convolution.cs | 9 -- src/ImageProcessor/Imaging/FastBitmap.cs | 130 ++++++++------- .../Filters/Artistic/HalftoneFilter.cs | 5 +- .../Imaging/Helpers/Adjustments.cs | 4 +- src/ImageProcessor/Imaging/Helpers/Effects.cs | 1 + src/ImageProcessor/Settings.StyleCop | 3 + 10 files changed, 170 insertions(+), 150 deletions(-) create mode 100644 src/ImageProcessor.Playground/images/input/tree.jpg.REMOVED.git-id diff --git a/src/ImageProcessor.Playground/Program.cs b/src/ImageProcessor.Playground/Program.cs index b3d5b35d1b..4975a3f038 100644 --- a/src/ImageProcessor.Playground/Program.cs +++ b/src/ImageProcessor.Playground/Program.cs @@ -60,7 +60,8 @@ namespace ImageProcessor.PlayGround //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "gamma-1.0-or-2.2.png")); //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "gamma_dalai_lama_gray.jpg")); //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "Arc-de-Triomphe-France.jpg")); - FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "Martin-Schoeller-Jack-Nicholson-Portrait.jpeg")); + //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "Martin-Schoeller-Jack-Nicholson-Portrait.jpeg")); + //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "tree.jpg")); //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "test2.png")); //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "120430.gif")); //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "rickroll.original.gif")); @@ -70,87 +71,89 @@ namespace ImageProcessor.PlayGround //IEnumerable files = GetFilesByExtensions(di, ".gif"); //IEnumerable files = GetFilesByExtensions(di, ".png", ".jpg", ".jpeg"); //IEnumerable files = GetFilesByExtensions(di, ".jpg", ".jpeg", ".jfif"); - //IEnumerable files = GetFilesByExtensions(di, ".gif", ".webp", ".bmp", ".jpg", ".png"); + //IEnumerable files = GetFilesByExtensions(di, ".png"); + IEnumerable files = GetFilesByExtensions(di, ".gif", ".webp", ".bmp", ".jpg", ".png"); - //foreach (FileInfo fileInfo in files) - //{ - // if (fileInfo.Name == "test5.jpg") - // { - // continue; - // } + foreach (FileInfo fileInfo in files) + { + if (fileInfo.Name == "test5.jpg") + { + continue; + } - byte[] photoBytes = File.ReadAllBytes(fileInfo.FullName); - Console.WriteLine("Processing: " + fileInfo.Name); + byte[] photoBytes = File.ReadAllBytes(fileInfo.FullName); + Console.WriteLine("Processing: " + fileInfo.Name); - Stopwatch stopwatch = new Stopwatch(); - stopwatch.Start(); + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); - // ImageProcessor - using (MemoryStream inStream = new MemoryStream(photoBytes)) - { - using (ImageFactory imageFactory = new ImageFactory(true, false)) + // ImageProcessor + using (MemoryStream inStream = new MemoryStream(photoBytes)) { - Size size = new Size(600, 0); - //CropLayer cropLayer = new CropLayer(20, 20, 20, 20, ImageProcessor.Imaging.CropMode.Percentage); - //ResizeLayer layer = new ResizeLayer(size, ResizeMode.Max, AnchorPosition.Center, false); - - //ContentAwareResizeLayer layer = new ContentAwareResizeLayer(size) - //{ - // ConvolutionType = ConvolutionType.Sobel - //}; - // Load, resize, set the format and quality and save an image. - imageFactory.Load(inStream) - //.DetectObjects(EmbeddedHaarCascades.FrontFaceDefault) - //.Overlay(new ImageLayer - // { - // Image = overlay, - // Opacity = 50 - // }) - //.Alpha(50) - //.BackgroundColor(Color.White) - //.Resize(new Size((int)(size.Width * 1.1), 0)) - //.ContentAwareResize(layer) - //.Constrain(size) - //.Mask(mask) - //.Format(new PngFormat()) - //.BackgroundColor(Color.Cyan) - //.ReplaceColor(Color.FromArgb(255, 223, 224), Color.FromArgb(121, 188, 255), 128) - //.GaussianSharpen(3) - //.Saturation(20) - .Resize(size) - //.Resize(new ResizeLayer(size, ResizeMode.Max)) - // .Resize(new ResizeLayer(size, ResizeMode.Stretch)) - //.DetectEdges(new Laplacian3X3EdgeFilter(), true) - //.DetectEdges(new LaplacianOfGaussianEdgeFilter()) - //.GaussianBlur(new GaussianLayer(10, 11)) - //.EntropyCrop() - //.Halftone() - //.RotateBounded(150, false) - //.Crop(cropLayer) - //.Rotate(140) - //.Filter(MatrixFilters.Invert) - //.Contrast(50) - //.Filter(MatrixFilters.Comic) - //.Flip() - //.Filter(MatrixFilters.HiSatch) - //.Pixelate(8) - //.GaussianSharpen(10) - //.Format(new PngFormat() { IsIndexed = true }) - //.Format(new PngFormat() ) - .Save(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path), @"..\..\images\output", fileInfo.Name))); - //.Save(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path), @"..\..\images\output", Path.GetFileNameWithoutExtension(fileInfo.Name) + ".png"))); - - stopwatch.Stop(); + using (ImageFactory imageFactory = new ImageFactory(true, true)) + { + Size size = new Size(600, 0); + //CropLayer cropLayer = new CropLayer(20, 20, 20, 20, ImageProcessor.Imaging.CropMode.Percentage); + //ResizeLayer layer = new ResizeLayer(size, ResizeMode.Max, AnchorPosition.Center, false); + + //ContentAwareResizeLayer layer = new ContentAwareResizeLayer(size) + //{ + // ConvolutionType = ConvolutionType.Sobel + //}; + // Load, resize, set the format and quality and save an image. + imageFactory.Load(inStream) + //.DetectObjects(EmbeddedHaarCascades.FrontFaceDefault) + //.Overlay(new ImageLayer + // { + // Image = overlay, + // Opacity = 50 + // }) + //.Alpha(50) + //.BackgroundColor(Color.White) + //.Resize(new Size((int)(size.Width * 1.1), 0)) + //.ContentAwareResize(layer) + //.Constrain(size) + //.Mask(mask) + //.Format(new PngFormat()) + //.BackgroundColor(Color.Cyan) + //.ReplaceColor(Color.FromArgb(255, 223, 224), Color.FromArgb(121, 188, 255), 128) + //.GaussianSharpen(3) + //.Saturation(20) + //.Resize(size) + //.Resize(new ResizeLayer(size, ResizeMode.Max)) + // .Resize(new ResizeLayer(size, ResizeMode.Stretch)) + //.DetectEdges(new SobelEdgeFilter(), true) + //.DetectEdges(new LaplacianOfGaussianEdgeFilter()) + //.GaussianBlur(new GaussianLayer(10, 11)) + //.EntropyCrop() + .Halftone() + //.RotateBounded(150, false) + //.Crop(cropLayer) + //.Rotate(140) + //.Filter(MatrixFilters.Invert) + //.Brightness(-5) + //.Contrast(50) + //.Filter(MatrixFilters.Comic) + //.Flip() + //.Filter(MatrixFilters.HiSatch) + //.Pixelate(8) + //.GaussianSharpen(10) + //.Format(new PngFormat() { IsIndexed = true }) + //.Format(new PngFormat() ) + .Save(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path), @"..\..\images\output", fileInfo.Name))); + //.Save(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path), @"..\..\images\output", Path.GetFileNameWithoutExtension(fileInfo.Name) + ".png"))); + + stopwatch.Stop(); + } } - } - long peakWorkingSet64 = Process.GetCurrentProcess().PeakWorkingSet64; - float mB = peakWorkingSet64 / (float)1024 / 1024; + long peakWorkingSet64 = Process.GetCurrentProcess().PeakWorkingSet64; + float mB = peakWorkingSet64 / (float)1024 / 1024; - Console.WriteLine(@"Completed {0} in {1:s\.fff} secs {2}Peak memory usage was {3} bytes or {4} Mb.", fileInfo.Name, stopwatch.Elapsed, Environment.NewLine, peakWorkingSet64.ToString("#,#"), mB); + Console.WriteLine(@"Completed {0} in {1:s\.fff} secs {2}Peak memory usage was {3} bytes or {4} Mb.", fileInfo.Name, stopwatch.Elapsed, Environment.NewLine, peakWorkingSet64.ToString("#,#"), mB); - //Console.WriteLine("Processed: " + fileInfo.Name + " in " + stopwatch.ElapsedMilliseconds + "ms"); - //} + //Console.WriteLine("Processed: " + fileInfo.Name + " in " + stopwatch.ElapsedMilliseconds + "ms"); + } Console.ReadLine(); } diff --git a/src/ImageProcessor.Playground/images/input/tree.jpg.REMOVED.git-id b/src/ImageProcessor.Playground/images/input/tree.jpg.REMOVED.git-id new file mode 100644 index 0000000000..013af9f99d --- /dev/null +++ b/src/ImageProcessor.Playground/images/input/tree.jpg.REMOVED.git-id @@ -0,0 +1 @@ +f5e8e6f09d2e518da37e698b6113b82e8f21dcd1 \ No newline at end of file diff --git a/src/ImageProcessor.Web.PostProcessor/PostProcessorBootstrapper.cs b/src/ImageProcessor.Web.PostProcessor/PostProcessorBootstrapper.cs index 9297995045..86e6bfc3bf 100644 --- a/src/ImageProcessor.Web.PostProcessor/PostProcessorBootstrapper.cs +++ b/src/ImageProcessor.Web.PostProcessor/PostProcessorBootstrapper.cs @@ -58,11 +58,11 @@ namespace ImageProcessor.Web.PostProcessor // Get the resources and copy them across. Dictionary resources = new Dictionary { - {"gifsicle.exe","ImageProcessor.Web.PostProcessor.Resources.Unmanaged." + folder + ".gifsicle.exe"}, - {"jpegtran.exe","ImageProcessor.Web.PostProcessor.Resources.Unmanaged.x86.jpegtran.exe"}, - {"optipng.exe","ImageProcessor.Web.PostProcessor.Resources.Unmanaged.x86.optipng.exe"}, - {"pngout.exe","ImageProcessor.Web.PostProcessor.Resources.Unmanaged.x86.pngout.exe"}, - {"png.cmd","ImageProcessor.Web.PostProcessor.Resources.Unmanaged.x86.png.cmd" } + { "gifsicle.exe", "ImageProcessor.Web.PostProcessor.Resources.Unmanaged." + folder + ".gifsicle.exe" }, + { "jpegtran.exe", "ImageProcessor.Web.PostProcessor.Resources.Unmanaged.x86.jpegtran.exe" }, + { "optipng.exe", "ImageProcessor.Web.PostProcessor.Resources.Unmanaged.x86.optipng.exe" }, + { "pngout.exe", "ImageProcessor.Web.PostProcessor.Resources.Unmanaged.x86.pngout.exe" }, + { "png.cmd", "ImageProcessor.Web.PostProcessor.Resources.Unmanaged.x86.png.cmd" } }; // Write the files out to the bin folder. diff --git a/src/ImageProcessor.Web.PostProcessor/Settings.StyleCop b/src/ImageProcessor.Web.PostProcessor/Settings.StyleCop index bb05f99bc1..8e2713ede5 100644 --- a/src/ImageProcessor.Web.PostProcessor/Settings.StyleCop +++ b/src/ImageProcessor.Web.PostProcessor/Settings.StyleCop @@ -1 +1,7 @@ - \ No newline at end of file + + + + executables + + + \ No newline at end of file diff --git a/src/ImageProcessor/Imaging/Convolution.cs b/src/ImageProcessor/Imaging/Convolution.cs index 0c9d820519..554375b6d8 100644 --- a/src/ImageProcessor/Imaging/Convolution.cs +++ b/src/ImageProcessor/Imaging/Convolution.cs @@ -335,10 +335,6 @@ namespace ImageProcessor.Imaging green += k * color.G; blue += k * color.B; alpha += k * color.A; - //red += k * (color.R * color.R); - //green += k * (color.G * color.G); - //blue += k * (color.B * color.B); - //alpha += k * (color.A * color.A); processedKernelSize++; } @@ -364,11 +360,6 @@ namespace ImageProcessor.Imaging // Check and apply the divider if ((long)divider != 0) { - //red = Math.Sqrt(red / divider); - //green = Math.Sqrt(green / divider); - //blue = Math.Sqrt(blue / divider); - //alpha = Math.Sqrt(alpha / divider); - red /= divider; green /= divider; blue /= divider; diff --git a/src/ImageProcessor/Imaging/FastBitmap.cs b/src/ImageProcessor/Imaging/FastBitmap.cs index 6df46aefbf..750ccad645 100644 --- a/src/ImageProcessor/Imaging/FastBitmap.cs +++ b/src/ImageProcessor/Imaging/FastBitmap.cs @@ -22,6 +22,30 @@ namespace ImageProcessor.Imaging /// public unsafe class FastBitmap : IDisposable { + /// + /// The integral representation of the 8bppIndexed pixel format. + /// + // ReSharper disable once InconsistentNaming + private const int Format8bppIndexed = (int)PixelFormat.Format8bppIndexed; + + /// + /// The integral representation of the 24bppRgb pixel format. + /// + // ReSharper disable once InconsistentNaming + private const int Format24bppRgb = (int)PixelFormat.Format24bppRgb; + + /// + /// The integral representation of the 32bppArgb pixel format. + /// + // ReSharper disable once InconsistentNaming + private const int Format32bppArgb = (int)PixelFormat.Format32bppArgb; + + /// + /// The integral representation of the 32bppPArgb pixel format. + /// + // ReSharper disable once InconsistentNaming + private const int Format32bppPArgb = (int)PixelFormat.Format32bppPArgb; + /// /// The bitmap. /// @@ -37,11 +61,6 @@ namespace ImageProcessor.Imaging /// private readonly int height; - /// - /// The size of the a single pixel. - /// - private readonly int pixelSize; - /// /// The color channel - blue, green, red, alpha. /// @@ -55,27 +74,27 @@ namespace ImageProcessor.Imaging /// /// The normal integral image. /// - private readonly long[,] normalSumImage; + private long[,] normalSumImage; /// /// The squared integral image. /// - private readonly long[,] squaredSumImage; + private long[,] squaredSumImage; /// /// The tilted sum image. /// - private readonly long[,] tiltedSumImage; + private long[,] tiltedSumImage; /// /// The normal width. /// - private readonly int normalWidth; + private int normalWidth; /// /// The tilted width. /// - private readonly int tiltedWidth; + private int tiltedWidth; /// /// The number of bytes in a row. @@ -112,6 +131,11 @@ namespace ImageProcessor.Imaging /// private GCHandle tiltedSumHandle; + /// + /// The size of the color32 structure. + /// + private int pixelSize; + /// /// The bitmap data. /// @@ -153,46 +177,25 @@ namespace ImageProcessor.Imaging /// public FastBitmap(Image bitmap, bool computeTilted) { + int pixelFormat = (int)bitmap.PixelFormat; + // Check image format - if (!(bitmap.PixelFormat == PixelFormat.Format8bppIndexed || - bitmap.PixelFormat == PixelFormat.Format24bppRgb || - bitmap.PixelFormat == PixelFormat.Format32bppArgb || - bitmap.PixelFormat == PixelFormat.Format32bppPArgb)) + if (!(pixelFormat == Format8bppIndexed || + pixelFormat == Format24bppRgb || + pixelFormat == Format32bppArgb || + pixelFormat == Format32bppPArgb)) { throw new ArgumentException("Only 8bpp, 24bpp and 32bpp images are supported."); } - this.pixelSize = Image.GetPixelFormatSize(bitmap.PixelFormat) / 8; - this.bitmap = (Bitmap)bitmap; this.width = this.bitmap.Width; this.height = this.bitmap.Height; - this.channel = this.bitmap.PixelFormat == PixelFormat.Format8bppIndexed ? 0 : 2; - this.computeTilted = computeTilted; - - this.normalWidth = this.width + 1; - int normalHeight = this.height + 1; - - this.tiltedWidth = this.width + 2; - int tiltedHeight = this.height + 2; - - this.normalSumImage = new long[normalHeight, this.normalWidth]; - this.normalSumHandle = GCHandle.Alloc(this.normalSumImage, GCHandleType.Pinned); - this.normalSum = (long*)this.normalSumHandle.AddrOfPinnedObject().ToPointer(); - this.squaredSumImage = new long[normalHeight, this.normalWidth]; - this.squaredSumHandle = GCHandle.Alloc(this.squaredSumImage, GCHandleType.Pinned); - this.squaredSum = (long*)this.squaredSumHandle.AddrOfPinnedObject().ToPointer(); - - if (this.computeTilted) - { - this.tiltedSumImage = new long[tiltedHeight, this.tiltedWidth]; - this.tiltedSumHandle = GCHandle.Alloc(this.tiltedSumImage, GCHandleType.Pinned); - this.tiltedSum = (long*)this.tiltedSumHandle.AddrOfPinnedObject().ToPointer(); - } + this.channel = pixelFormat == Format8bppIndexed ? 0 : 2; + this.computeTilted = computeTilted; this.LockBitmap(); - this.CalculateIntegrals(); } /// @@ -260,13 +263,13 @@ namespace ImageProcessor.Imaging /// /// Allows the implicit conversion of an instance of to a - /// . + /// . /// /// /// The instance of to convert. /// /// - /// An instance of . + /// An instance of . /// public static implicit operator Image(FastBitmap fastBitmap) { @@ -308,14 +311,7 @@ namespace ImageProcessor.Imaging } #endif Color32* data = this[x, y]; - - if (this.bitmap.PixelFormat == PixelFormat.Format32bppArgb || - this.bitmap.PixelFormat == PixelFormat.Format32bppPArgb) - { - return Color.FromArgb(data->A, data->R, data->G, data->B); - } - - return Color.FromArgb(data->R, data->G, data->B); + return Color.FromArgb(data->A, data->R, data->G, data->B); } /// @@ -344,12 +340,7 @@ namespace ImageProcessor.Imaging data->R = color.R; data->G = color.G; data->B = color.B; - - if (this.bitmap.PixelFormat == PixelFormat.Format32bppArgb || - this.bitmap.PixelFormat == PixelFormat.Format32bppPArgb) - { - data->A = color.A; - } + data->A = color.A; } /// @@ -511,6 +502,7 @@ namespace ImageProcessor.Imaging // Figure out the number of bytes in a row. This is rounded up to be a multiple // of 4 bytes, since a scan line in an image must always be a multiple of 4 bytes // in length. + this.pixelSize = Image.GetPixelFormatSize(this.bitmap.PixelFormat) / 8; this.bytesInARow = bounds.Width * this.pixelSize; if (this.bytesInARow % 4 != 0) { @@ -518,10 +510,34 @@ namespace ImageProcessor.Imaging } // Lock the bitmap - this.bitmapData = this.bitmap.LockBits(bounds, ImageLockMode.ReadWrite, this.bitmap.PixelFormat); + this.bitmapData = this.bitmap.LockBits(bounds, ImageLockMode.ReadWrite, PixelFormat.Format32bppPArgb); // Set the value to the first scan line this.pixelBase = (byte*)this.bitmapData.Scan0.ToPointer(); + + // Allocate values for integral image calculation. + this.normalWidth = this.width + 1; + int normalHeight = this.height + 1; + + this.tiltedWidth = this.width + 2; + int tiltedHeight = this.height + 2; + + this.normalSumImage = new long[normalHeight, this.normalWidth]; + this.normalSumHandle = GCHandle.Alloc(this.normalSumImage, GCHandleType.Pinned); + this.normalSum = (long*)this.normalSumHandle.AddrOfPinnedObject().ToPointer(); + + this.squaredSumImage = new long[normalHeight, this.normalWidth]; + this.squaredSumHandle = GCHandle.Alloc(this.squaredSumImage, GCHandleType.Pinned); + this.squaredSum = (long*)this.squaredSumHandle.AddrOfPinnedObject().ToPointer(); + + if (this.computeTilted) + { + this.tiltedSumImage = new long[tiltedHeight, this.tiltedWidth]; + this.tiltedSumHandle = GCHandle.Alloc(this.tiltedSumImage, GCHandleType.Pinned); + this.tiltedSum = (long*)this.tiltedSumHandle.AddrOfPinnedObject().ToPointer(); + } + + this.CalculateIntegrals(); } /// @@ -638,4 +654,4 @@ namespace ImageProcessor.Imaging this.pixelBase = null; } } -} +} \ No newline at end of file diff --git a/src/ImageProcessor/Imaging/Filters/Artistic/HalftoneFilter.cs b/src/ImageProcessor/Imaging/Filters/Artistic/HalftoneFilter.cs index 2009b87f30..3bab509a74 100644 --- a/src/ImageProcessor/Imaging/Filters/Artistic/HalftoneFilter.cs +++ b/src/ImageProcessor/Imaging/Filters/Artistic/HalftoneFilter.cs @@ -200,7 +200,8 @@ namespace ImageProcessor.Imaging.Filters.Artistic // Yellow oversaturates the output. int offset = this.distance; - float yellowMultiplier = this.distance * 1.667f; + float yellowMultiplier = this.distance * 1.334f; + float magentaMultiplier = this.distance * 1.667f; float multiplier = this.distance * 2.2f; float max = this.distance * (float)Math.Sqrt(2); @@ -289,7 +290,7 @@ namespace ImageProcessor.Imaging.Filters.Artistic { color = sourceBitmap.GetPixel(angledX, angledY); cmykColor = color; - brushWidth = Math.Min((cmykColor.M / 100f) * multiplier, max); + brushWidth = Math.Min((cmykColor.M / 100f) * magentaMultiplier, max); graphicsMagenta.FillEllipse(magentaBrush, angledX, angledY, brushWidth, brushWidth); } diff --git a/src/ImageProcessor/Imaging/Helpers/Adjustments.cs b/src/ImageProcessor/Imaging/Helpers/Adjustments.cs index 0d4ea2d4f7..fd4812bcd7 100644 --- a/src/ImageProcessor/Imaging/Helpers/Adjustments.cs +++ b/src/ImageProcessor/Imaging/Helpers/Adjustments.cs @@ -15,8 +15,6 @@ namespace ImageProcessor.Imaging.Helpers using System.Drawing.Imaging; using System.Threading.Tasks; - using ImageProcessor.Common.Extensions; - /// /// Provides reusable adjustment methods to apply to images. /// @@ -97,7 +95,7 @@ namespace ImageProcessor.Imaging.Helpers } float brightnessFactor = (float)threshold / 100; - Rectangle bounds = rectangle.HasValue ? rectangle.Value : new Rectangle(0, 0, source.Width, source.Height); + Rectangle bounds = rectangle ?? new Rectangle(0, 0, source.Width, source.Height); ColorMatrix colorMatrix = new ColorMatrix( diff --git a/src/ImageProcessor/Imaging/Helpers/Effects.cs b/src/ImageProcessor/Imaging/Helpers/Effects.cs index 9c37242146..a328e19a6c 100644 --- a/src/ImageProcessor/Imaging/Helpers/Effects.cs +++ b/src/ImageProcessor/Imaging/Helpers/Effects.cs @@ -235,6 +235,7 @@ namespace ImageProcessor.Imaging.Helpers // Darken it again to average out the color. destination = Adjustments.Brightness(destination, -5); + return (Bitmap)destination; } } diff --git a/src/ImageProcessor/Settings.StyleCop b/src/ImageProcessor/Settings.StyleCop index 32b31a9023..b10054568f 100644 --- a/src/ImageProcessor/Settings.StyleCop +++ b/src/ImageProcessor/Settings.StyleCop @@ -2,7 +2,9 @@ Accord + argb bitstream + bpp dd ddd dllimport @@ -13,6 +15,7 @@ mmmm orig quantizable + rgb Scharr Sobel specifier