示例#1
0
        static MagickImage pencilImage(int width = 256, int height = 256)
        {
            //convert -size 256x256 xc:  +noise Random  -virtual-pixel tile -motion-blur 0x20+135 -charcoal 1   pencil_tile.gif
            MagickImage result = new MagickImage(new MagickColor("white"), width, height);

            result.AddNoise(NoiseType.Random);
            result.MotionBlur(0, 20, 135);
            result.Charcoal(1, 1);
            result.Threshold(new Percentage(50));
            return(result);
        }
示例#2
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);
                    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(conf.Param1, conf.Param2);
                    break;

                case 7:
                    image.BlueShift();
                    break;

                case 8:
                    image.RotationalBlur(conf.Param1);
                    break;

                case 9:
                    image.Raise(conf.Param1);
                    break;
                }
                image.Format = MagickFormat.Jpeg;
                image.Write(dest);
            }
            return(dest);
        }