Example #1
0
 private void Det_OnFailure(object sender, DetectAdapterEventAgrs e)
 {
     using (MemoryStream ms = new MemoryStream())
     {
         ImageCodecInfo    jpgEncoder    = BitmapExtensions.GetEncoderInfo(ImageFormat.Jpeg);
         EncoderParameters encoderParams = new EncoderParameters(1);
         EncoderParameter  encoderParam  = new EncoderParameter(Encoder.Quality, 75L);
         encoderParams.Param[0] = encoderParam;
         using (Bitmap img = new Bitmap(Path.Combine(Global.PluginRoot, "Content/ui/faceNotFound.jpg")))
             img.Save(ms, jpgEncoder, encoderParams);
         Result = Convert.ToBase64String(ms.ToArray());
     }
 }
Example #2
0
 private void Det_OnSuccess(object sender, DetectAdapterEventAgrs e)
 {
     using (FaceDrawer faceDrawer = new FaceDrawer())
         using (Image image = faceDrawer.Draw(e.Face, imageToProcess))
             using (MemoryStream ms = new MemoryStream())
             {
                 ImageCodecInfo    jpgEncoder    = BitmapExtensions.GetEncoderInfo(ImageFormat.Jpeg);
                 EncoderParameters encoderParams = new EncoderParameters(1);
                 EncoderParameter  encoderParam  = new EncoderParameter(Encoder.Quality, 75L);
                 encoderParams.Param[0] = encoderParam;
                 image.Save(ms, jpgEncoder, encoderParams);
                 Result = Convert.ToBase64String(ms.ToArray());
             }
 }