Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
MOHAMMAD committed Jul 24, 2020
1 parent bd5a610 commit b3b0c8d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
17 changes: 13 additions & 4 deletions SilverBullet.ImageProcessor/Processors/MakeTransparent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Drawing;
using ImageProcessor.Common.Exceptions;

namespace ImageProcessor.Processors
{
Expand All @@ -10,9 +12,16 @@ public class MakeTransparent : IGraphicsProcessor

public Image ProcessImage(ImageFactory factory)
{
var bmp = factory.Bitmap;
bmp.MakeTransparent(bmp.GetPixel(1, 1));
return bmp;
try
{
var bmp = factory.Bitmap;
bmp.MakeTransparent(bmp.GetPixel(1, 1));
return bmp;
}
catch (Exception ex)
{
throw new ImageProcessingException("Error processing image with " + this.GetType().Name, ex);
}
}
}
}
17 changes: 13 additions & 4 deletions SilverBullet.ImageProcessor/Processors/Median.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Drawing;
using ImageProcessor.Common.Exceptions;
using SilverBullet.ImageProcessor.Imaging.Helpers;

namespace ImageProcessor.Processors
Expand All @@ -11,9 +13,16 @@ public class Median : IGraphicsProcessor

public Image ProcessImage(ImageFactory factory)
{
var ksize = (int)DynamicParameter;
return ImageHelper.OpenCvProcessor(factory.Bitmap,
(src) => src.MedianBlur(ksize));
try
{
var ksize = (int)DynamicParameter;
return ImageHelper.OpenCvProcessor(factory.Bitmap,
(src) => src.MedianBlur(ksize));
}
catch (Exception ex)
{
throw new ImageProcessingException("Error processing image with " + this.GetType().Name, ex);
}
}
}
}

0 comments on commit b3b0c8d

Please sign in to comment.