public void CreateImagesForOtherColor(int campaignId, string prodIdAndColor, CampaignProductRecord p, DesignInfo data, string frontPath, string backPath, string color) { var destForder = Path.Combine(Server.MapPath("/Media/campaigns/"), campaignId.ToString(), prodIdAndColor); if (!Directory.Exists(destForder)) { Directory.CreateDirectory(destForder); } if (!Directory.Exists(destForder + "/normal")) { Directory.CreateDirectory(destForder + "/normal"); } if (!Directory.Exists(destForder + "/big")) { Directory.CreateDirectory(destForder + "/big"); } var frontTemplate = new Bitmap(frontPath); var backTemplate = new Bitmap(backPath); var rgba = ColorTranslator.FromHtml(color); var front = BuildProductImage(frontTemplate, _imageHelper.Base64ToBitmap(data.Front), rgba, p.ProductRecord.ProductImageRecord.Width, p.ProductRecord.ProductImageRecord.Height, p.ProductRecord.ProductImageRecord.PrintableFrontTop, p.ProductRecord.ProductImageRecord.PrintableFrontLeft, p.ProductRecord.ProductImageRecord.PrintableFrontWidth, p.ProductRecord.ProductImageRecord.PrintableFrontHeight); front.Save(Path.Combine(destForder, "normal", "front.png")); var back = BuildProductImage(backTemplate, _imageHelper.Base64ToBitmap(data.Back), rgba, p.ProductRecord.ProductImageRecord.Width, p.ProductRecord.ProductImageRecord.Height, p.ProductRecord.ProductImageRecord.PrintableBackTop, p.ProductRecord.ProductImageRecord.PrintableBackLeft, p.ProductRecord.ProductImageRecord.PrintableBackWidth, p.ProductRecord.ProductImageRecord.PrintableBackHeight); back.Save(Path.Combine(destForder, "normal", "back.png")); _imageHelper.ResizeImage(front, p.ProductRecord.ProductImageRecord.Width * 2, p.ProductRecord.ProductImageRecord.Height * 2).Save(Path.Combine(destForder, "big", "front.png")); _imageHelper.ResizeImage(back, p.ProductRecord.ProductImageRecord.Width * 2, p.ProductRecord.ProductImageRecord.Height * 2).Save(Path.Combine(destForder, "big", "back.png")); frontTemplate.Dispose(); backTemplate.Dispose(); front.Dispose(); back.Dispose(); }