Example #1
0
        private static void Scale()
        {
            string path = Config.GetCurrentDir() + "img/qr.jpg";
            string path2 = Config.GetCurrentDir() + "img/scale5.jpg";
            //bool res = DrawingImages.ScaleByWidth(path, path2, 120);
            //bool res2 = DrawingImages.Resize(path, path2, 300, 150, DrawingImages.SizingType.HW);
            //Console.WriteLine(res2);

            var img = new EditImage(path);
            var res = img.ScaleByWidth(path2, 300);
            Console.WriteLine(res);
        }
Example #2
0
        private static void Merge()
        {
            string path = Config.GetCurrentDir() + "img/qr.jpg";

            string path2 = Config.GetCurrentDir() + "img/52.jpg";

            string savePath = Config.GetCurrentDir() + "img/r2.jpg";

            //DrawingImages.Merge(path, savePath, path2, 155, 155);
            var edit = new EditImage(path);

            //var mark = edit.ScaleFromPath(path2, 160, ScaleType.W);
            //var mark = edit.MergeCenter(edit.ImageFromPath(path2), edit.ImageFromText("Chan", "red"));
            //edit.DrawingMerge(edit.ImageFromText("Chan", "#000"), 0, 0);
            //edit.DrawingMergeCenter(edit.ImageFromPath(path2), 120, ScaleType.W, 320);
            //edit.DrawingRotate(320);
            var res = edit.MergeCenter(savePath, path2, 120);
            Console.WriteLine(res);
        }
Example #3
0
        private static void qrMerge()
        {
            string temp = Config.GetCurrentDir() + "Template/temp.jpg";

            string path = Config.GetCurrentDir() + "img/qr.jpg";

            string head = Config.GetCurrentDir() + "img/52.jpg";

            string savePath = Config.GetCurrentDir() + "imgs/m2.jpg";
            //string savePath2 = Config.GetCurrentDir() + "imgs/m3.jpg";

            var sw = new Stopwatch();
            sw.Start();
            var editimg = new EditImage(temp);
            //var editimg2 = new EditImage(temp);
            var qrMixHead = editimg.MergeCenter(editimg.ImageFromPath(path), editimg.ImageFromPath(head));

            editimg.DrawingMerge(qrMixHead, 96, 428, 260, ScaleType.W, 352);

            var txtImg = editimg.ImageFromText("Chan");
            int x = 90 + (340 - txtImg.Width) / 2;
            editimg.DrawingMerge(txtImg, x, 708, null, ScaleType.W, 352);

            editimg.Save(savePath);
            //editimg2.Save(savePath2);
            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds.ToString());
        }