Пример #1
0
        public void Run()
        {
            // TODO:
            // Grab an image from a public URL and write a function thats rescale the image to a desired format
            // The use of 3rd party plugins is permitted
            // For example: 100x80 (thumbnail) and 1200x1600 (preview)


            // Install-Package ImageLibrary
            // http://kaliko.com/image-library/

            Directory.CreateDirectory(@"C:\MyImages");

            var image = new KalikoImage(@"https://web.usask.ca/images/homer.jpg");

            image.SaveJpg(@"C:\MyImages\org.jpg", 99);

            // Create thumbnail by cropping
            KalikoImage thumb = image.Scale(new CropScaling(128, 128));

            thumb.SaveJpg(@"C:\MyImages\thumbnail-fit.jpg", 99);

            // Create preview 1200x1600
            image.Resize(1600, 1200);
            image.SaveJpg(@"C:\MyImages\preview.jpg", 99);

            Console.WriteLine("Images saved to C:\\MyImages\\");
        }
Пример #2
0
 public void CropAndResizeImage(Image image, string outPutFilePath, string outPuthFileName, int?width = null, int?height = null, bool pngFormat = false)
 {
     try
     {
         if (!width.HasValue)
         {
             width = new int?(image.Width);
         }
         if (!height.HasValue)
         {
             height = new int?(image.Height);
         }
         KalikoImage kalikoImage  = new KalikoImage(image);
         KalikoImage kalikoImage1 = kalikoImage.Scale(new FitScaling(width.Value, height.Value));
         if (!Directory.Exists(HttpContext.Current.Server.MapPath(string.Concat("~/", outPutFilePath))))
         {
             Directory.CreateDirectory(HttpContext.Current.Server.MapPath(string.Concat("~/", outPutFilePath)));
         }
         string str = HttpContext.Current.Server.MapPath(string.Concat("~/", Path.Combine(outPutFilePath, outPuthFileName)));
         if (!pngFormat)
         {
             kalikoImage1.SaveJpg(str, (long)99);
         }
         else
         {
             kalikoImage1.SavePng(str);
         }
         kalikoImage1.Dispose();
         kalikoImage.Dispose();
     }
     catch (Exception exception)
     {
         throw new Exception(exception.Message);
     }
 }
Пример #3
0
        public string Execute(FileItem item, string infile, string dest, ValuePairEnumerator configData)
        {
            try
            {
                var conf = new ChromakeyViewModel(configData);
                dest = Path.Combine(Path.GetDirectoryName(dest), Path.GetFileNameWithoutExtension(dest) + ".jpg");

                KalikoImage image  = new KalikoImage(infile);
                var         x      = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(conf.BackgroundColor);
                var         filter = new ChromaKeyFilter();
                filter.KeyColor             = Color.FromArgb(x.R, x.G, x.B);
                filter.ToleranceHue         = conf.Hue;
                filter.ToleranceSaturnation = conf.Saturnation / 100f;
                filter.ToleranceBrightness  = conf.Brigthness / 100f;
                image.ApplyFilter(filter);
                var res = image.Clone();

                if (conf.UnsharpMask)
                {
                    res.ApplyFilter(new UnsharpMaskFilter(1.4f, 1.32f, 5));
                }

                var backdrop = new KalikoImage(conf.BackgroundFile);
                backdrop = backdrop.Scale(new FitScaling(image.Width, image.Height));
                backdrop.BlitImage(res);

                backdrop.SaveJpg(dest, 90);
                return(dest);
            }
            catch (Exception e)
            {
                Log.Debug("Chromakey error", e);
            }
            return(null);
        }
Пример #4
0
        /// <summary>
        /// Processes the images.
        /// </summary>
        /// <param name="groupName">Name of the group.</param>
        public static void ProcessImages(string groupName)
        {
            try
            {
                var settings = SettingsHelper.Get();

                string fileFolder = settings.BaseReportPath + "\\" + groupName;

                if (Directory.Exists(fileFolder))
                {
                    var imgLocations = Directory.GetFiles(fileFolder, "*.png", SearchOption.AllDirectories);

                    foreach (var imgLoc in imgLocations)
                    {
                        using (KalikoImage image = new KalikoImage(imgLoc))
                        {
                            using (KalikoImage thumb = image.Scale(new FitScaling(200, 200)))
                            {
                                thumb.SaveJpg(imgLoc.ToJpgThumbFileName(), 90);
                            }

                            image.SaveJpg(imgLoc.ToJpgImageFileName(), 90);
                        }

                        FileFolderRemover.DeleteFile(imgLoc);
                    }
                }
            }
            catch (Exception ex)
            {
                LoggerService.LogException(ex);
            }
        }
        // GET: Formation/Details/5
        public ActionResult Details(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Formation p;

            p = MyFormationService.GetById((int)id);
            if (p == null)
            {
                return(HttpNotFound());
            }
            FormationVM pvm = new FormationVM()
            {
                FormationID = p.FormationID,
                Title       = p.Title,
                Affiche     = p.Affiche,
                Start       = p.Start,
                End         = p.End,
                Description = p.Description,
                Location    = p.Location,
                Price       = p.Price,
                Theme       = p.Theme,
                NbrMax      = p.NbrMax
            };
            var t = MyActiviteService.GetMany();

            foreach (Activite A in t)
            {
                if (string.IsNullOrEmpty(A.Affiche))
                {
                    var         path  = Path.Combine(Server.MapPath("~/Content/Front/images/event/event_02.jpg"));
                    KalikoImage image = new KalikoImage(path);
                    KalikoImage thumb = image.Scale(new CropScaling(90, 80));
                    var         path2 = Path.Combine(Server.MapPath("~/Content/Uploads"), A.Title + "latest.jpg");
                    thumb.SaveJpg(path2, 99);
                    A.Affiche = A.Title + "latest.jpg";
                }
                else
                {
                    var         path  = Path.Combine(Server.MapPath("~/Content/Uploads"), A.Affiche);
                    KalikoImage image = new KalikoImage(path);
                    KalikoImage thumb = image.Scale(new CropScaling(90, 80));
                    var         path2 = Path.Combine(Server.MapPath("~/Content/Uploads"), A.Title + "latest.jpg");
                    thumb.SaveJpg(path2, 99);
                    A.Affiche = A.Title + "latest.jpg";
                }
            }
            List <Activite> Courses = t.ToList();

            ViewData["Courses"] = Courses;

            return(View(pvm));
        }
Пример #6
0
        public void Unsharpmask(object b22)
        {
            KalikoImage image = new KalikoImage("C:\\Users\\Dima\\Pictures\\1.jpg");

            // Create a thumbnail of 128x128 pixels
            KalikoImage thumb = image.GetThumbnailImage(128, 128, ThumbnailMethod.Crop);

            // Apply unsharpen filter (radius = 1.4, amount = 32%, threshold = 0)
            thumb.ApplyFilter(new UnsharpMaskFilter(1.4f, 0.32f, 0));

            // Save the thumbnail as JPG in quality 99 (very high)
            thumb.SaveJpg("C:\\Users\\Dima\\Pictures\\1111.jpg", 99);
        }
Пример #7
0
        static void Main(string[] args)
        {
            KalikoImage image = new KalikoImage("testimage.jpg");

            image.BackgroundColor = Color.Aquamarine;

            image.Scale(new FitScaling(100, 100)).SaveJpg("thumbnail-fit.jpg", 90);

            image.Scale(new CropScaling(100, 100)).SaveJpg("thumbnail-crop.jpg", 90);

            image.Scale(new PadScaling(100, 100)).SaveJpg("thumbnail-pad.jpg", 90);

            KalikoImage sharpimg = image.Scale(new CropScaling(100, 100));

            sharpimg.ApplyFilter(new UnsharpMaskFilter(1.2f, 0.3f, 1));
            sharpimg.SaveJpg("thumbnail-unsharpened.jpg", 90);

            sharpimg.ApplyFilter(new DesaturationFilter());
            sharpimg.SaveJpg("thumbnail-gray.jpg", 90);

            sharpimg.ApplyFilter(new ContrastFilter(30));
            sharpimg.SaveJpg("thumbnail-contrast.jpg", 90);
        }
Пример #8
0
        private void button5_Click(object sender, EventArgs e)
        {
            //Bitmap bmp = new Bitmap(pictureBox1.Image);
            //Thread Unsharpmaskthread = new Thread(Unsharpmask);
            //Unsharpmaskthread.Start(bmp);
            KalikoImage image = new KalikoImage("C:\\Users\\Dima\\Pictures\\1.jpg");

            // Create a thumbnail of 128x128 pixels
            //KalikoImage thumb = image.GetThumbnailImage(128, 128, ThumbnailMethod.Crop);

            // Apply unsharpen filter (radius = 1.4, amount = 32%, threshold = 0)
            image.ApplyFilter(new UnsharpMaskFilter(1.4f, 0.32f, 0));

            // Save the thumbnail as JPG in quality 99 (very high)
            image.SaveJpg("C:\\Users\\Dima\\Pictures\\1111.jpg", 99);
        }
Пример #9
0
        // GET: Activite/Details/5
        public ActionResult Details(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Activite A;

            A = activiteService.GetById((int)id);
            if (A == null)
            {
                return(HttpNotFound());
            }
            ActiviteVM pvm = new ActiviteVM()
            {
                ActiviteID  = A.ActiviteID,
                Title       = A.Title,
                Description = A.Description,
                Affiche     = A.Affiche,
                Document    = A.Document,
                Theme       = A.Theme,
                Outils      = A.Outils,
                AgeMin      = A.AgeMin,
                AgeMax      = A.AgeMax,
                ClassSize   = A.ClassSize,
                Duration    = A.Duration,
                Professor   = A.Professor,
                Start       = A.Start,
                Location    = A.Location,
                //    nomuser = User.Identity.GetUserName(),
                UserId = "f43c21cf-f35a-4897-a9e3-343c00afe7b3"
            };
            var t = activiteService.GetMany();

            foreach (Activite Act in t)
            {
                var         path1 = Path.Combine(Server.MapPath("~/Content/Uploads"), Act.Affiche);
                KalikoImage image = new KalikoImage(path1);
                KalikoImage thumb = image.Scale(new CropScaling(90, 80));
                var         path2 = Path.Combine(Server.MapPath("~/Content/Uploads"), Act.Title + "latest.jpg");
                thumb.SaveJpg(path2, 99);
            }
            List <Activite> Courses = t.ToList();

            ViewData["Courses"] = Courses;
            return(View(pvm));
        }
Пример #10
0
        private string SaveImage()
        {
            if (!DoesImageNeedHandling)
            {
                return(_originalPath);
            }

            var image = new KalikoImage(Server.MapPath(_originalPath));

            // TODO: Temporary fix for selecting full image, try to do this without loading the image first..
            if (IsCropValueFullImage(image))
            {
                return(_originalPath);
            }

            if (_hasCropValues)
            {
                image.Crop(_cropX, _cropY, _cropW, _cropH);
            }

            if (_width > 0 || _height > 0)
            {
                image.Resize(_width, _height);
            }

            var imagePath  = GetNewImagePath();
            var serverPath = Server.MapPath(imagePath);

            if (File.Exists(serverPath))
            {
                var originalServerPath = Server.MapPath(_originalPath);

                if (File.GetLastWriteTime(originalServerPath) < File.GetLastWriteTime(serverPath))
                {
                    return(imagePath);
                }

                File.Delete(serverPath);
            }

            // TODO: Config quality
            image.SaveJpg(Server.MapPath(imagePath), 90);

            return(imagePath);
        }
        // GET: Formation
        public ActionResult Index(string searchString, int?i)
        {
            var Formations = new List <FormationVM>();

            foreach (Formation p in MyFormationService.SearchFormByName(searchString))
            {
                if (string.IsNullOrEmpty(p.Affiche))
                {
                    var         path  = Path.Combine(Server.MapPath("~/Content/Front/images/event/event_02.jpg"));
                    KalikoImage image = new KalikoImage(path);
                    KalikoImage thumb = image.Scale(new CropScaling(250, 250));
                    var         path2 = Path.Combine(Server.MapPath("~/Content/Uploads"), p.Title + "thumb.jpg");
                    thumb.SaveJpg(path2, 99);
                }
                else
                {
                    var         path  = Path.Combine(Server.MapPath("~/Content/Uploads"), p.Affiche);
                    KalikoImage image = new KalikoImage(path);
                    KalikoImage thumb = image.Scale(new CropScaling(250, 250));
                    var         path2 = Path.Combine(Server.MapPath("~/Content/Uploads"), p.Title + "thumb.jpg");
                    thumb.SaveJpg(path2, 99);
                }


                Formations.Add(new FormationVM()
                {
                    FormationID = p.FormationID,
                    Title       = p.Title,
                    Start       = p.Start,
                    End         = p.End,
                    Description = p.Description,
                    // Affiche = p.Affiche,
                    Affiche  = p.Title + "thumb.jpg",
                    NbrMax   = p.NbrMax,
                    Theme    = p.Theme,
                    Location = p.Location,
                    Price    = p.Price
                });
            }
            return(View(Formations.ToPagedList(i ?? 1, 3)));
        }
Пример #12
0
        public void CropAndResizeImage(HttpPostedFileBase imageFile, string outPutFilePath, string outPuthFileName, int width, int height, bool pngFormat = false)
        {
            try
            {
                Image image = Image.FromStream(imageFile.InputStream);
                //if (!width.HasValue)
                //{
                //	width = image.Width;
                //}
                //if (!height.HasValue)
                //{
                //	height = new int?(image.Height);
                //}
                KalikoImage kalikoImage = new KalikoImage(image);

                kalikoImage.Resize(width, height);

                //KalikoImage kalikoImage1 = kalikoImage.Scale(new CropScaling(width, height));
                //KalikoImage kalikoImage1 = kalikoImage.Scale(new FitScaling(width.Value, height.Value));
                if (!Directory.Exists(HttpContext.Current.Server.MapPath(string.Concat("~/", outPutFilePath))))
                {
                    Directory.CreateDirectory(HttpContext.Current.Server.MapPath(string.Concat("~/", outPutFilePath)));
                }
                string str = HttpContext.Current.Server.MapPath(string.Concat("~/", Path.Combine(outPutFilePath, outPuthFileName)));
                if (!pngFormat)
                {
                    kalikoImage.SaveJpg(str, 99);
                }
                else
                {
                    kalikoImage.SavePng(str);
                }
                kalikoImage.Dispose();
                //kalikoImage.Dispose();
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }
Пример #13
0
            public uint Def_ReadFile(string filename, IntPtr buffer, uint BufferSize, ref uint NumberByteReadSuccess, long Offset, IntPtr info)
            {
                StringBuilder data  = new StringBuilder();
                VNode         Node  = new VNode(filename);
                string        query = "";

                byte[] file = null;

                Console.WriteLine("reading {0} {1} {2}", Node.isValid, Node.fileName, Node.curDir);
                if (Node.isValid && Node.param.TryGetValue("q", out query))
                {
                    #region This Is google Service
                    if (Node.fileName.StartsWith("google", StringComparison.CurrentCultureIgnoreCase))
                    {
                        Task <Google.Apis.Customsearch.v1.Data.Search> ret;
                        if (Node.param.ContainsKey("n"))
                        {
                            int    n    = 1;
                            string temp = "";
                            Node.param.TryGetValue("n", out temp);
                            int.TryParse(temp, out n);
                            ret = ServiceProvider.SearchGoogle(query, n);
                        }
                        else
                        {
                            ret = ServiceProvider.SearchGoogle(query, 1);
                        }
                        ret.Wait();
                        if (ret.Result.Items != null)
                        {
                            foreach (Google.Apis.Customsearch.v1.Data.Result s in ret.Result.Items)
                            {
                                data.AppendLine(s.Title);
                                data.AppendLine("----------------------------------------------------------------");
                                data.AppendLine(s.Snippet);
                                data.AppendLine(s.Link);
                                data.Append("\n");
                            }
                        }
                        Console.WriteLine(data.ToString());
                        file = System.Text.Encoding.ASCII.GetBytes(data.ToString());
                    }
                    #endregion
                }
                else if (Node.curDir == "ImagePass")
                {
                    if (!Node.fileExtention.EndsWith("inf", StringComparison.CurrentCultureIgnoreCase) && !Node.fileExtention.EndsWith("ini", StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (imageFiles.Any(name => name.StartsWith(Node.fileName)))
                        {
                            Console.WriteLine("Direct Read");
                            KalikoImage image = new KalikoImage(filepath + @"\" + imageFiles.Where(d => d.StartsWith(Node.fileName)).ToList()[0]);
                            Console.WriteLine("HEHFKHLDSKHFLSDHLKFHKD *()&*&(&**&(" + image.ByteArray.Length);
                            string width = "", height = "", OP = "", x = "", y = "";
                            System.IO.MemoryStream ms = new System.IO.MemoryStream();

                            Node.param.TryGetValue("op", out OP);
                            if (OP == "s" && Node.param.TryGetValue("w", out width) && Node.param.TryGetValue("h", out width))
                            {
                                int w = 0, h = 0;
                                if (int.TryParse(width, out w) && int.TryParse(width, out h))
                                {
                                    image.Scale(new FitScaling(w, h)).SavePng(ms);
                                }
                            }
                            if (OP == "c" && Node.param.TryGetValue("w", out width) && Node.param.TryGetValue("h", out width) && Node.param.TryGetValue("x", out x) && Node.param.TryGetValue("y", out y))
                            {
                                int w = 0, h = 0, X, Y;

                                if (int.TryParse(width, out w) && int.TryParse(width, out h) && int.TryParse(x, out X) && int.TryParse(y, out Y))
                                {
                                    image.Crop(X, Y, w, h);
                                }
                                image.SavePng(ms);
                            }

                            string ext = Node.fileExtention.ToLowerInvariant();


                            switch (ext)
                            {
                            case "png":
                                image.LoadImage(ms);
                                image.SavePng(ms);

                                break;

                            case "gif":
                                image.LoadImage(ms);
                                image.SaveGif(ms);
                                break;

                            case "bmp":
                                image.LoadImage(ms);
                                image.SaveBmp(ms);
                                break;

                            default:
                                image.LoadImage(ms);
                                image.SaveJpg(ms, 100);
                                break;
                            }
                            file = ms.ToArray();
                        }
                    }
                }


                if (file != null && file.Length != 0 && Offset < file.Length)
                {
                    if (BufferSize > file.Length - Offset)
                    {
                        NumberByteReadSuccess = (uint)(file.Length - Offset);
                        System.Runtime.InteropServices.Marshal.Copy(file, (int)Offset, buffer, (int)NumberByteReadSuccess);
                    }
                    else
                    {
                        NumberByteReadSuccess = BufferSize;
                        System.Runtime.InteropServices.Marshal.Copy(file, (int)Offset, buffer, (int)BufferSize);
                    }
                    return(0);
                }
                else
                {
                    Console.WriteLine("Error param {0}", Node.fileName);
                    return(0xC000000F);
                }
            }
Пример #14
0
        // WARNING: Very ugly code ahead, quick and dirty method to generate an image
        private Dictionary <string, string> BuildCDMBar(string barName, string barNameBackgroundColour, string ingredient1, string ingredient2, string ingredient3, string directoryId, string userImagesPath)
        {
            // Locate base directory for CDM bar assets
            string cdmBarAssetsPath = Path.Combine(GetRequestApplicationPath(), "App_Data", "cdm_bar");

            var    fileId        = Guid.NewGuid().ToString("N");
            string imageFilePath = $"{directoryId}/{fileId}-1.jpg";
            //string imageShareFilePath = $"{directoryId}/{fileId}-2.jpg";
            string imageShareWideFilePath = $"{directoryId}/{fileId}-3.jpg";

            // Count the amount of ingredients
            int ingredientAmount = 0;

            ingredientAmount += !String.IsNullOrEmpty(ingredient1) ? 1 : 0;
            ingredientAmount += !String.IsNullOrEmpty(ingredient2) ? 1 : 0;
            ingredientAmount += !String.IsNullOrEmpty(ingredient3) ? 1 : 0;

            // Create a new canvas based on background image (helps in getting a dynamic dimension also)
            String backgroundImagePath = Path.Combine(cdmBarAssetsPath, "background.png");

            using (var image = new KalikoImage(backgroundImagePath))
            {
                // Composite the image with ingredients by blitting, yeah too many nested IFs
                if (ingredientAmount > 0)
                {
                    var ingredient1ImagePath = Path.Combine(cdmBarAssetsPath, ingredient1.ToLower());
                    using (var ingredientImage = new KalikoImage(ingredient1ImagePath))
                    {
                        // Very important to set the image to the same resolution as the exported file, else proportions won't be maintained
                        ingredientImage.SetResolution(96, 96);
                        image.BlitImage(ingredientImage, 2596, 1090);
                    }

                    if (ingredientAmount > 1)
                    {
                        var ingredient2ImagePath = Path.Combine(cdmBarAssetsPath, ingredient2.ToLower());
                        using (var ingredientImage = new KalikoImage(ingredient2ImagePath))
                        {
                            // Very important to set the image to the same resolution as the exported file, else proportions won't be maintained
                            ingredientImage.SetResolution(96, 96);
                            image.BlitImage(ingredientImage, 2646, 698);
                        }

                        if (ingredientAmount > 2)
                        {
                            var ingredient3ImagePath = Path.Combine(cdmBarAssetsPath, ingredient3.ToLower());
                            using (var ingredientImage = new KalikoImage(ingredient3ImagePath))
                            {
                                // Very important to set the image to the same resolution as the exported file, else proportions won't be maintained
                                ingredientImage.SetResolution(96, 96);
                                image.BlitImage(ingredientImage, 2390, 392);
                            }
                        }
                    }
                }

                // Overlay the CDM Bar with "masking" holes
                var cdmBarImagePath = Path.Combine(cdmBarAssetsPath, $"bar-ingredient-x{ingredientAmount.ToString()}.png");
                using (var cdmBarImage = new KalikoImage(cdmBarImagePath))
                {
                    cdmBarImage.SetResolution(96, 96);
                    image.BlitImage(cdmBarImage);
                }

                GC.Collect();
                GC.WaitForPendingFinalizers();

                // Overlay the text background if any
                if (!(String.IsNullOrEmpty(barNameBackgroundColour) || barNameBackgroundColour.ToLower().Equals("transparent")))
                {
                    var barNameBackgroundImagePath = Path.Combine(cdmBarAssetsPath, $"back-{barNameBackgroundColour.ToLower()}.png");
                    using (var barNameBackgroundImage = new KalikoImage(barNameBackgroundImagePath))
                    {
                        barNameBackgroundImage.SetResolution(96, 96);
                        image.BlitImage(barNameBackgroundImage);
                    }
                }

                // Add the final touch, the "pièce de résistance", the centered angled text!
                var fontPath = Path.Combine(cdmBarAssetsPath, "MonkyBasicRegular.ttf");
                image.SetFont(fontPath, 110, FontStyle.Regular);
                var text = new TextField(barName.ToUpper());
                text.Rotation          = -14.1f;
                text.TextColor         = Color.White;
                text.Alignment         = StringAlignment.Center;
                text.VerticalAlignment = StringAlignment.Center;
                text.TargetArea        = new Rectangle(900, 1231, 1800, 618);
                image.DrawText(text);

                // Create destination directory if it doesn't already exist
                String destinationDirectoryPath = Path.Combine(userImagesPath, directoryId);
                System.IO.Directory.CreateDirectory(destinationDirectoryPath);

                // Create the share image (square aspect ratio)

                /*
                 * String backgroundShareImagePath = Path.Combine(cdmBarAssetsPath, "background-share.png");
                 * using (var shareImage = new KalikoImage(backgroundShareImagePath))
                 * {
                 *  shareImage.SetResolution(96, 96);
                 *  shareImage.BlitImage(image);
                 *
                 *  // Save the square share image
                 *  String destinationShareFilePath = Path.Combine(userImagesPath, imageShareFilePath);
                 *  // Resize it for front-end display
                 *  shareImage.Resize(1200, 1200);
                 *  shareImage.SaveJpg(destinationShareFilePath, 90, true);
                 * }
                 */

                // Create the share image (wide aspect ratio)
                String backgroundShareImageWidePath = Path.Combine(cdmBarAssetsPath, "background-share-wide.png");
                using (var shareImageWide = new KalikoImage(backgroundShareImageWidePath))
                {
                    shareImageWide.SetResolution(96, 96);
                    shareImageWide.BlitImage(image, 1286, -68);
                    // Compose the text onto the image
                    String textShareImageWidePath = Path.Combine(cdmBarAssetsPath, "text-share-wide.png");
                    using (var shareTextWide = new KalikoImage(textShareImageWidePath))
                    {
                        shareTextWide.SetResolution(96, 96);
                        shareImageWide.BlitImage(shareTextWide);
                    }

                    // Save the wide share image
                    String destinationShareWideFilePath = Path.Combine(userImagesPath, imageShareWideFilePath);
                    // Resize it for front-end display
                    shareImageWide.Resize(1200, 630);
                    shareImageWide.SaveJpg(destinationShareWideFilePath, 90, true);
                }

                GC.Collect();
                GC.WaitForPendingFinalizers();

                // Save the composited image
                String destinationFilePath = Path.Combine(userImagesPath, imageFilePath);
                image.SetResolution(96, 96);
                // Resize it for front-end display
                image.Resize(520, 360);
                image.SaveJpg(destinationFilePath, 90, true);
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();

            return(new Dictionary <string, string> {
                { "FileId", fileId },
                { "CompositedImage", imageFilePath },
                { "CompositedImageShare", imageShareWideFilePath },
                { "CompositedImageShareWide", imageShareWideFilePath }
            });
        }