Esempio n. 1
0
 public string Execute(FileItem item, string infile, string dest, ValuePairEnumerator configData)
 {
     var conf = new EffectViewModel(configData);
     dest = Path.Combine(Path.GetDirectoryName(dest), Path.GetFileNameWithoutExtension(dest) + ".jpg");
     using (MagickImage image = new MagickImage(infile))
     {
         switch (conf.SelectedMode)
         {
             case 0:
                 image.SepiaTone(new Percentage(conf.Param1));
                 break;
             case 1:
                 image.OilPaint(conf.Param1,0.1);
                 break;
             case 2:
                 image.Sketch();
                 break;
             case 3:
                 image.Charcoal();
                 break;
             case 4:
                 image.Solarize();
                 break;
             case 5:
                 image.Swirl(conf.Param1);
                 break;
             case 6:
                 image.Wave(PixelInterpolateMethod.Bilinear, conf.Param1, conf.Param2);
                 break;
             case 7:
                 image.BlueShift();
                 break;
             case 8:
                 image.RotationalBlur(conf.Param1);
                 break;
             case 9:
                 image.Raise(conf.Param1);
                 break;
             case 10:
                 image.Negate();
                 break;
             case 11:
                 image.ColorSpace = ColorSpace.Gray;
                 break;
         }
         image.Format = MagickFormat.Jpeg;
         image.Write(dest);
     }
     return dest;
 }
Esempio n. 2
0
 private void ExecuteRaise(XmlElement element, MagickImage image)
 {
   Int32 size_ = Variables.GetValue<Int32>(element, "size");
   image.Raise(size_);
 }
Esempio n. 3
0
    public void Test_Raise_Lower()
    {
      using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
      {
        image.Raise(30);

        ColorAssert.AreEqual(new MagickColor("#6ee29508b532"), image, 29, 30);
        ColorAssert.AreEqual(new MagickColor("#2f2054867aac"), image, 570, 265);
      }

      using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG))
      {
        image.Lower(30);

        ColorAssert.AreEqual(new MagickColor("#2da153c773f1"), image, 29, 30);
        ColorAssert.AreEqual(new MagickColor("#706195c7bbed"), image, 570, 265);
      }
    }