From 7d9618696fa67a632578fcfaefb45ca845c8823a Mon Sep 17 00:00:00 2001 From: James South Date: Sun, 7 Sep 2014 19:58:11 +0100 Subject: [PATCH] ImageProcessor.Plugins.Cair v1.0.0 Former-commit-id: 1e5dbabd84e93e80b32c3a4bfb106109d3b46dcc --- build/Build.ImageProcessor.Plugins.Cair.proj | 54 +++++++++++++++ build/Build.bat | 7 +- .../ImageProcessor.Plugins.Cair.nuspec | 37 +++++++++++ .../ImageProcessor.Plugins.WebP.nuspec | 60 +++++++++-------- .../NuSpecs/ImageProcessor.Web.Config.nuspec | 66 ++++++++++--------- build/NuSpecs/ImageProcessor.Web.nuspec | 62 +++++++++-------- build/NuSpecs/ImageProcessor.nuspec | 50 +++++++------- src/ImageProcessorConsole/Program.cs | 18 ++++- ...git-id => night-bridge.png.REMOVED.git-id} | 0 .../output/2006-citybus.jpg.REMOVED.git-id | 2 +- .../images/output/2008.jpg.REMOVED.git-id | 2 +- .../output/2012-citybus.jpg.REMOVED.git-id | 2 +- .../Arc-de-Triomphe-France.jpg.REMOVED.git-id | 2 +- .../output/Image with gaps.jpg.REMOVED.git-id | 2 +- ...e_triomphe_paris_france.jpg.REMOVED.git-id | 2 +- .../images/output/mountain.jpg.REMOVED.git-id | 2 +- .../images/output/rotate.jpg.REMOVED.git-id | 2 +- ...Arc_de_triomphe-square1.jpg.REMOVED.git-id | 2 +- .../images/output/test.jpg.REMOVED.git-id | 2 +- .../Processors/ContentAwareResize.cs | 28 ++++---- 20 files changed, 266 insertions(+), 136 deletions(-) create mode 100644 build/Build.ImageProcessor.Plugins.Cair.proj create mode 100644 build/NuSpecs/ImageProcessor.Plugins.Cair.nuspec rename src/ImageProcessorConsole/images/input/{night-bridge.jpg.REMOVED.git-id => night-bridge.png.REMOVED.git-id} (100%) diff --git a/build/Build.ImageProcessor.Plugins.Cair.proj b/build/Build.ImageProcessor.Plugins.Cair.proj new file mode 100644 index 000000000..d4668467d --- /dev/null +++ b/build/Build.ImageProcessor.Plugins.Cair.proj @@ -0,0 +1,54 @@ + + + .\ + + + + + + + + Release + _BuildOutput\ + False + $(MSBuildProjectDirectory)\$(BuildFolder) + $(BuildFolderAbsolutePath)ImageProcessor.Plugins.Cair\lib\net45 + ..\src\Plugins\ImageProcessor\ImageProcessor.Plugins.Cair\ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/Build.bat b/build/Build.bat index f5ec6373b..deb60032f 100644 --- a/build/Build.bat +++ b/build/Build.bat @@ -4,8 +4,11 @@ SET version=2.0.1.0 SET webversion=4.0.0.0 SET webconfigversion=2.0.0.0 SET webppluginversion=1.0.1.0 +SET cairpluginversion=1.0.0.0 -ECHO Building ImageProcessor %version%, ImageProcessor.Web %webversion%, ImageProcessor.Web.Config %webconfigversion%, and ImageProcessor.Plugins.WebP %webppluginversion% +ECHO Building ImageProcessor %version%, ImageProcessor.Web %webversion%, ImageProcessor.Web.Config %webconfigversion% + +ECHO Building ImageProcessor.Plugins.WebP %webppluginversion%, ImageProcessor.Plugins.Cair %cairpluginversion% ECHO Removing _BuildOutput directory so everything is nice and clean RD _BuildOutput /q /s @@ -13,12 +16,14 @@ RD _BuildOutput /q /s %windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.ImageProcessor.proj" /p:BUILD_RELEASE=%version% /p:BUILD_COMMENT=%comment% %windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.ImageProcessor.Web.proj" /p:BUILD_RELEASE=%webversion% /p:BUILD_COMMENT=%comment% %windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.ImageProcessor.Plugins.WebP.proj" /p:BUILD_RELEASE=%webppluginversion% /p:BUILD_COMMENT=%comment% +%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe "Build.ImageProcessor.Plugins.Cair.proj" /p:BUILD_RELEASE=%cairpluginversion% /p:BUILD_COMMENT=%comment% ECHO Packing the NuGet release files ..\src\.nuget\NuGet.exe pack NuSpecs\ImageProcessor.nuspec -Version %version% ..\src\.nuget\NuGet.exe pack NuSpecs\ImageProcessor.Web.nuspec -Version %webversion% ..\src\.nuget\NuGet.exe pack NuSpecs\ImageProcessor.Web.Config.nuspec -Version %webconfigversion% ..\src\.nuget\NuGet.exe pack NuSpecs\ImageProcessor.Plugins.WebP.nuspec -Version %webppluginversion% +..\src\.nuget\NuGet.exe pack NuSpecs\ImageProcessor.Plugins.Cair.nuspec -Version %cairpluginversion% PAUSE IF ERRORLEVEL 1 GOTO :showerror diff --git a/build/NuSpecs/ImageProcessor.Plugins.Cair.nuspec b/build/NuSpecs/ImageProcessor.Plugins.Cair.nuspec new file mode 100644 index 000000000..3560ec154 --- /dev/null +++ b/build/NuSpecs/ImageProcessor.Plugins.Cair.nuspec @@ -0,0 +1,37 @@ + + + + ImageProcessor.Plugins.Cair + 1.0.0.0 + ImageProcessor.Plugins.Cair + James South + James South + http://imageprocessor.org + http://raw.githubusercontent.com/JimBobSquarePants/ImageProcessor/master/build/content/imageprocessor.128.png + false + + Adds support to ImageProcessor for Content Aware Image Resizing. + + If you use ImageProcessor please get in touch via my twitter @james_m_south + + Feedback is always welcome + + Adds support to ImageProcessor for Content Aware Image Resizing. + + James South + en-GB + + Image Imaging ASP Performance Processing HttpModule Cache Resize AutoRotate Rotate RoundedCorners + Flip Crop Filter Effects Quality Watermark Alpha Vignette Saturation Brightness Contrast Gif Jpg Jpeg + Bitmap Png WebP Tiff Fluent GDI Gaussian Blur Sharpen Tint Quantizer Animated EXIF Cair SeamCarving + + + + + + + + + + + diff --git a/build/NuSpecs/ImageProcessor.Plugins.WebP.nuspec b/build/NuSpecs/ImageProcessor.Plugins.WebP.nuspec index 2b73746c5..98826898d 100644 --- a/build/NuSpecs/ImageProcessor.Plugins.WebP.nuspec +++ b/build/NuSpecs/ImageProcessor.Plugins.WebP.nuspec @@ -1,32 +1,38 @@  - - ImageProcessor.Plugins.WebP - 1.0.0.0 - ImageProcessor.Plugins.WebP - James South - James South - http://imageprocessor.org - http://raw.githubusercontent.com/JimBobSquarePants/ImageProcessor/master/build/content/imageprocessor.128.png - false - Adds support to ImageProcessor for the WebP image format. + + ImageProcessor.Plugins.WebP + 1.0.0.0 + ImageProcessor.Plugins.WebP + James South + James South + http://imageprocessor.org + http://raw.githubusercontent.com/JimBobSquarePants/ImageProcessor/master/build/content/imageprocessor.128.png + false + + Adds support to ImageProcessor for the WebP image format. -If you use ImageProcessor please get in touch via my twitter @james_m_south + If you use ImageProcessor please get in touch via my twitter @james_m_south -Feedback is always welcome - Adds support to ImageProcessor for the WebP image format. - - James South - en-GB - Image Imaging ASP Performance Processing HttpModule Cache Resize Rotate RoundedCorners Flip Crop Filter Effects Quality Watermark Alpha Vignette Saturation Brightness Contrast Gif Jpg Jpeg Bitmap Png WebP Fluent GDI Gaussian Blur Sharpen Tint Quantizer Animated - - - - - - - - - - + Feedback is always welcome + + Adds support to ImageProcessor for the WebP image format. + + James South + en-GB + + Image Imaging ASP Performance Processing HttpModule Cache Resize AutoRotate Rotate RoundedCorners + Flip Crop Filter Effects Quality Watermark Alpha Vignette Saturation Brightness Contrast Gif Jpg Jpeg + Bitmap Png WebP Tiff Fluent GDI Gaussian Blur Sharpen Tint Quantizer Animated EXIF Cair SeamCarving + + + + + + + + + + + diff --git a/build/NuSpecs/ImageProcessor.Web.Config.nuspec b/build/NuSpecs/ImageProcessor.Web.Config.nuspec index 45786ebd5..0b66945df 100644 --- a/build/NuSpecs/ImageProcessor.Web.Config.nuspec +++ b/build/NuSpecs/ImageProcessor.Web.Config.nuspec @@ -1,35 +1,41 @@ - - ImageProcessor.Web.Config - 1.1.0.0 - ImageProcessor.Web.Config - James South - James South - http://imageprocessor.org - http://raw.githubusercontent.com/JimBobSquarePants/ImageProcessor/master/build/content/imageprocessor.128.png - false - Adds configuration to your ImageProcessor.Web solution to allow you to override the default settings. + + ImageProcessor.Web.Config + 1.1.0.0 + ImageProcessor.Web.Config + James South + James South + http://imageprocessor.org + http://raw.githubusercontent.com/JimBobSquarePants/ImageProcessor/master/build/content/imageprocessor.128.png + false + + Adds configuration to your ImageProcessor.Web solution to allow you to override the default settings. -If you use ImageProcessor please get in touch via my twitter @james_m_south + If you use ImageProcessor please get in touch via my twitter @james_m_south -Feedback is always welcome - ImageProcessor.Web configuration settings for ASP.NET websites. - - James South - en-GB - Image Imaging ASP Performance Processing HttpModule Cache Resize Rotate RoundedCorners Flip Crop Filter Effects Quality Watermark Alpha Vignette Saturation Brightness Contrast Gif Jpg Jpeg Bitmap Png WebP Fluent GDI Gaussian Blur Sharpen Tint Quantizer Animated - - - - - - - - - - - - - + Feedback is always welcome + + ImageProcessor.Web configuration settings for ASP.NET websites. + + James South + en-GB + + Image Imaging ASP Performance Processing HttpModule Cache Resize AutoRotate Rotate RoundedCorners + Flip Crop Filter Effects Quality Watermark Alpha Vignette Saturation Brightness Contrast Gif Jpg Jpeg + Bitmap Png WebP Tiff Fluent GDI Gaussian Blur Sharpen Tint Quantizer Animated EXIF Cair SeamCarving + + + + + + + + + + + + + + diff --git a/build/NuSpecs/ImageProcessor.Web.nuspec b/build/NuSpecs/ImageProcessor.Web.nuspec index 9f765206e..ddcc68c94 100644 --- a/build/NuSpecs/ImageProcessor.Web.nuspec +++ b/build/NuSpecs/ImageProcessor.Web.nuspec @@ -1,34 +1,40 @@ - - ImageProcessor.Web - 3.2.0.0 - ImageProcessor.Web - James South - James South - http://imageprocessor.org - http://raw.githubusercontent.com/JimBobSquarePants/ImageProcessor/master/build/content/imageprocessor.128.png - false - ImageProcessor.Web adds a configurable HttpModule to your website which allows on-the-fly processing of image files. The module also comes with a file and browser based cache that can handle millions of images, increasing your processing output and saving precious server memory. + + ImageProcessor.Web + 3.2.0.0 + ImageProcessor.Web + James South + James South + http://imageprocessor.org + http://raw.githubusercontent.com/JimBobSquarePants/ImageProcessor/master/build/content/imageprocessor.128.png + false + + ImageProcessor.Web adds a configurable HttpModule to your website which allows on-the-fly processing of image files. The module also comes with a file and browser based cache that can handle millions of images, increasing your processing output and saving precious server memory. -Methods include: Resize, Rotate, Rounded Corners, Flip, Crop, Watermark, Filter, Saturation, Brightness, Contrast, Quality, Format, Vignette, Gaussian Blur, Gaussian Sharpen, and Transparency. + Methods include: Resize, Rotate, Rounded Corners, Flip, Crop, Watermark, Filter, Saturation, Brightness, Contrast, Quality, Format, Vignette, Gaussian Blur, Gaussian Sharpen, and Transparency. -If you use ImageProcessor please get in touch via my twitter @james_m_south + If you use ImageProcessor please get in touch via my twitter @james_m_south -Feedback is always welcome - An extension to ImageProcessor that allows on-the-fly processing of image files in an ASP.NET website - - James South - en-GB - Image Imaging ASP Performance Processing HttpModule Cache Resize AutoRotate Rotate RoundedCorners Flip Crop Filter Effects Quality Watermark Alpha Vignette Saturation Brightness Contrast Gif Jpg Jpeg Bitmap Png WebP Fluent GDI Gaussian Blur Sharpen Tint Quantizer Animated EXIF - - - - - - - - - - + Feedback is always welcome + + An extension to ImageProcessor that allows on-the-fly processing of image files in an ASP.NET website + + James South + en-GB + + Image Imaging ASP Performance Processing HttpModule Cache Resize AutoRotate Rotate RoundedCorners + Flip Crop Filter Effects Quality Watermark Alpha Vignette Saturation Brightness Contrast Gif Jpg Jpeg + Bitmap Png WebP Tiff Fluent GDI Gaussian Blur Sharpen Tint Quantizer Animated EXIF Cair SeamCarving + + + + + + + + + + + diff --git a/build/NuSpecs/ImageProcessor.nuspec b/build/NuSpecs/ImageProcessor.nuspec index 2b9c8af53..2e5f84fdf 100644 --- a/build/NuSpecs/ImageProcessor.nuspec +++ b/build/NuSpecs/ImageProcessor.nuspec @@ -1,28 +1,34 @@  - - ImageProcessor - 1.9.0.0 - ImageProcessor - James South - James South - http://imageprocessor.org - http://raw.githubusercontent.com/JimBobSquarePants/ImageProcessor/master/build/content/imageprocessor.128.png - false - Image Processor is an easy to use and extend processing library written in C#. Its fluent API makes common imaging tasks very simple to perform. + + ImageProcessor + 1.9.0.0 + ImageProcessor + James South + James South + http://imageprocessor.org + http://raw.githubusercontent.com/JimBobSquarePants/ImageProcessor/master/build/content/imageprocessor.128.png + false + + Image Processor is an easy to use and extend processing library written in C#. Its fluent API makes common imaging tasks very simple to perform. -Methods include; Resize, Rotate, Rounded Corners, Flip, Crop, Watermark, Filter, Saturation, Brightness, Contrast, Quality, Format, Vignette, Gaussian Blur, Gaussian Sharpen, and Transparency. + Methods include; Resize, Rotate, Rounded Corners, Flip, Crop, Watermark, Filter, Saturation, Brightness, Contrast, Quality, Format, Vignette, Gaussian Blur, Gaussian Sharpen, and Transparency. -If you use ImageProcessor please get in touch on my twitter @james_m_south. + If you use ImageProcessor please get in touch on my twitter @james_m_south. -Feedback is always welcome. - A library for manipulating image files written in C#. - - James South - en-GB - Image Imaging ASP Performance Processing Resize AutoRotate Rotate RoundedCorners Flip Crop Filter Effects Quality Watermark Alpha Vignette Saturation Brightness Contrast Gif Jpg Jpeg Bitmap Png WebP Fluent GDI Gaussian Blur Sharpen Tint Quantizer Animated EXIF - - - - + Feedback is always welcome. + + A library for manipulating image files written in C#. + + James South + en-GB + + Image Imaging ASP Performance Processing HttpModule Cache Resize AutoRotate Rotate RoundedCorners + Flip Crop Filter Effects Quality Watermark Alpha Vignette Saturation Brightness Contrast Gif Jpg Jpeg + Bitmap Png WebP Tiff Fluent GDI Gaussian Blur Sharpen Tint Quantizer Animated EXIF Cair SeamCarving + + + + + diff --git a/src/ImageProcessorConsole/Program.cs b/src/ImageProcessorConsole/Program.cs index 6293a3edc..f7658b7d1 100644 --- a/src/ImageProcessorConsole/Program.cs +++ b/src/ImageProcessorConsole/Program.cs @@ -12,11 +12,13 @@ namespace ImageProcessorConsole { using System; using System.Collections.Generic; + using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; using ImageProcessor; using ImageProcessor.Plugins.Cair; + using ImageProcessor.Plugins.Cair.Imaging; /// /// The program. @@ -48,6 +50,11 @@ namespace ImageProcessorConsole { byte[] photoBytes = File.ReadAllBytes(fileInfo.FullName); + Console.WriteLine("Processing: " + fileInfo.Name); + + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + // ImageProcessor using (MemoryStream inStream = new MemoryStream(photoBytes)) { @@ -55,15 +62,24 @@ namespace ImageProcessorConsole { Size size = new Size(800, 0); + ContentAwareResizeLayer layer = new ContentAwareResizeLayer(size) + { + ConvolutionType = ConvolutionType.Sobel + }; + // Load, resize, set the format and quality and save an image. imageFactory.Load(inStream) //.BackgroundColor(Color.White) //.Resize(new Size((int)(size.Width * 1.1), 0)) - .ContentAwareResize(size) + .ContentAwareResize(layer) //.Constrain(size) .Save(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path), @"..\..\images\output", fileInfo.Name))); + + stopwatch.Stop(); } } + + Console.WriteLine("Processed: " + fileInfo.Name + " in " + stopwatch.ElapsedMilliseconds + "ms"); } } diff --git a/src/ImageProcessorConsole/images/input/night-bridge.jpg.REMOVED.git-id b/src/ImageProcessorConsole/images/input/night-bridge.png.REMOVED.git-id similarity index 100% rename from src/ImageProcessorConsole/images/input/night-bridge.jpg.REMOVED.git-id rename to src/ImageProcessorConsole/images/input/night-bridge.png.REMOVED.git-id diff --git a/src/ImageProcessorConsole/images/output/2006-citybus.jpg.REMOVED.git-id b/src/ImageProcessorConsole/images/output/2006-citybus.jpg.REMOVED.git-id index 5fe88ad75..233b2595f 100644 --- a/src/ImageProcessorConsole/images/output/2006-citybus.jpg.REMOVED.git-id +++ b/src/ImageProcessorConsole/images/output/2006-citybus.jpg.REMOVED.git-id @@ -1 +1 @@ -33f7e25da5675197f18bb2fa2c9fe5fa366e84ec \ No newline at end of file +c6cb11afaf9fdb9181772246e5c873d8f7d1b99c \ No newline at end of file diff --git a/src/ImageProcessorConsole/images/output/2008.jpg.REMOVED.git-id b/src/ImageProcessorConsole/images/output/2008.jpg.REMOVED.git-id index fcb030451..01ba57354 100644 --- a/src/ImageProcessorConsole/images/output/2008.jpg.REMOVED.git-id +++ b/src/ImageProcessorConsole/images/output/2008.jpg.REMOVED.git-id @@ -1 +1 @@ -f24f17627804b11d823240d49c91ec17fb7fd55d \ No newline at end of file +10b48cac44776a023df7585ba2c68c3f51b0f803 \ No newline at end of file diff --git a/src/ImageProcessorConsole/images/output/2012-citybus.jpg.REMOVED.git-id b/src/ImageProcessorConsole/images/output/2012-citybus.jpg.REMOVED.git-id index 3ade52d60..731a81b1a 100644 --- a/src/ImageProcessorConsole/images/output/2012-citybus.jpg.REMOVED.git-id +++ b/src/ImageProcessorConsole/images/output/2012-citybus.jpg.REMOVED.git-id @@ -1 +1 @@ -def19dd7469cf2eba1f595e7263d9d48fda85825 \ No newline at end of file +e631eb3491496bb83f99cd41a752f79c9d7f6830 \ No newline at end of file diff --git a/src/ImageProcessorConsole/images/output/Arc-de-Triomphe-France.jpg.REMOVED.git-id b/src/ImageProcessorConsole/images/output/Arc-de-Triomphe-France.jpg.REMOVED.git-id index 83ecfe032..437ecbc46 100644 --- a/src/ImageProcessorConsole/images/output/Arc-de-Triomphe-France.jpg.REMOVED.git-id +++ b/src/ImageProcessorConsole/images/output/Arc-de-Triomphe-France.jpg.REMOVED.git-id @@ -1 +1 @@ -8cf61b55acca1a3d1a69177ddc439685ee0ba192 \ No newline at end of file +782056919992bb7e453eeee5d9c0034e03b57506 \ No newline at end of file diff --git a/src/ImageProcessorConsole/images/output/Image with gaps.jpg.REMOVED.git-id b/src/ImageProcessorConsole/images/output/Image with gaps.jpg.REMOVED.git-id index 7ea690341..99c38fa2f 100644 --- a/src/ImageProcessorConsole/images/output/Image with gaps.jpg.REMOVED.git-id +++ b/src/ImageProcessorConsole/images/output/Image with gaps.jpg.REMOVED.git-id @@ -1 +1 @@ -629284a6f834f5d1cf185e3603a50c484dd9121a \ No newline at end of file +1d9ded0201edcd248140b4ec02f69ccdb4b539e5 \ No newline at end of file diff --git a/src/ImageProcessorConsole/images/output/arc_de_triomphe_paris_france.jpg.REMOVED.git-id b/src/ImageProcessorConsole/images/output/arc_de_triomphe_paris_france.jpg.REMOVED.git-id index e3f15eac7..b55932abb 100644 --- a/src/ImageProcessorConsole/images/output/arc_de_triomphe_paris_france.jpg.REMOVED.git-id +++ b/src/ImageProcessorConsole/images/output/arc_de_triomphe_paris_france.jpg.REMOVED.git-id @@ -1 +1 @@ -3d652e0628f2042e7aca0751384ba21f1182ef5f \ No newline at end of file +2880457cc09cd2897b5f9f377807ec22f8f83013 \ No newline at end of file diff --git a/src/ImageProcessorConsole/images/output/mountain.jpg.REMOVED.git-id b/src/ImageProcessorConsole/images/output/mountain.jpg.REMOVED.git-id index 05e668428..aba0ec52f 100644 --- a/src/ImageProcessorConsole/images/output/mountain.jpg.REMOVED.git-id +++ b/src/ImageProcessorConsole/images/output/mountain.jpg.REMOVED.git-id @@ -1 +1 @@ -1c48519b2675b9dd90e8e95d6421148b25b8c317 \ No newline at end of file +34dcced6c7c3e4dd6fae239eba8eddef6234028d \ No newline at end of file diff --git a/src/ImageProcessorConsole/images/output/rotate.jpg.REMOVED.git-id b/src/ImageProcessorConsole/images/output/rotate.jpg.REMOVED.git-id index 5ebfcd78d..ec3d83b76 100644 --- a/src/ImageProcessorConsole/images/output/rotate.jpg.REMOVED.git-id +++ b/src/ImageProcessorConsole/images/output/rotate.jpg.REMOVED.git-id @@ -1 +1 @@ -a0aa8338f74f3539c2531f43fa9027a3ce0a39fb \ No newline at end of file +de6754762f7705f9109ea364f42ca128e454e853 \ No newline at end of file diff --git a/src/ImageProcessorConsole/images/output/shutterstock_19173982_Arc_de_triomphe-square1.jpg.REMOVED.git-id b/src/ImageProcessorConsole/images/output/shutterstock_19173982_Arc_de_triomphe-square1.jpg.REMOVED.git-id index 6f31ad7d1..481fa6aaa 100644 --- a/src/ImageProcessorConsole/images/output/shutterstock_19173982_Arc_de_triomphe-square1.jpg.REMOVED.git-id +++ b/src/ImageProcessorConsole/images/output/shutterstock_19173982_Arc_de_triomphe-square1.jpg.REMOVED.git-id @@ -1 +1 @@ -04f6093d3345a4c8b48333c32972753dd0949730 \ No newline at end of file +24db72130626e81b9a4262c891dd28e6d97e5a96 \ No newline at end of file diff --git a/src/ImageProcessorConsole/images/output/test.jpg.REMOVED.git-id b/src/ImageProcessorConsole/images/output/test.jpg.REMOVED.git-id index 8f920f20c..65ec37fb7 100644 --- a/src/ImageProcessorConsole/images/output/test.jpg.REMOVED.git-id +++ b/src/ImageProcessorConsole/images/output/test.jpg.REMOVED.git-id @@ -1 +1 @@ -f7b1543810ada7598773d6ee31bc7c0c20afaa9f \ No newline at end of file +4885438f0b97e3aae59d6e214b5ec455358ae225 \ No newline at end of file diff --git a/src/Plugins/ImageProcessor/ImageProcessor.Plugins.Cair/Processors/ContentAwareResize.cs b/src/Plugins/ImageProcessor/ImageProcessor.Plugins.Cair/Processors/ContentAwareResize.cs index 2f34eca57..aca83388b 100644 --- a/src/Plugins/ImageProcessor/ImageProcessor.Plugins.Cair/Processors/ContentAwareResize.cs +++ b/src/Plugins/ImageProcessor/ImageProcessor.Plugins.Cair/Processors/ContentAwareResize.cs @@ -131,13 +131,7 @@ namespace ImageProcessor.Plugins.Cair.Processors arguments = string.Format("{0} -W {1}", arguments, layer.WeightPath); } - bool success = this.ProcessCairImage(arguments, timeout); - - if (!success) - { - throw new ImageProcessingException( - "Error processing image with " + this.GetType().Name + " due to timeout."); - } + this.ProcessCairImage(arguments, timeout); // Assign the new image. newImage = new Bitmap(resizedPath); @@ -184,10 +178,7 @@ namespace ImageProcessor.Plugins.Cair.Processors /// /// The time in milliseconds to attempt to resize the image for. /// - /// - /// The . - /// - private bool ProcessCairImage(string arguments, int timeout) + private void ProcessCairImage(string arguments, int timeout) { // Set up and start a new process to resize the image. ProcessStartInfo start = new ProcessStartInfo(CairBootstrapper.CairExecutablePath, arguments) @@ -204,18 +195,21 @@ namespace ImageProcessor.Plugins.Cair.Processors { if (process != null) { - bool result = process.WaitForExit(timeout); - - if (!result) + if (!process.WaitForExit(timeout)) { process.Kill(); + + throw new ImageProcessingException("Error processing image with " + this.GetType().Name + " due to timeout."); } - return result; + string output = string.Format(" {0} {1}", process.StandardError.ReadToEnd(), process.StandardOutput.ReadToEnd()); + + if (process.ExitCode != 0) + { + throw new ImageProcessingException("Error processing image with " + this.GetType().Name + output); + } } } - - return false; } } }