public async Task <IActionResult> Update(long id, IList <IFormFile> logo, IList <IFormFile> background) { var itemBlock = Context.ItemBlocks.SingleOrDefault(w => w.Id == id); if (itemBlock == null) { return(List()); } var uploadedLogo = logo.ImageUpload(HostingEnv.WebRootPath, false); var uploadedBackground = background.ImageUpload(HostingEnv.WebRootPath, false); var removeImages = new List <string>(); if (uploadedLogo.Any()) { if (!string.IsNullOrEmpty(itemBlock.LogoUrl)) { removeImages.Add($"{HostingEnv.WebRootPath}{itemBlock.LogoUrl}"); } itemBlock.LogoUrl = uploadedLogo.First().Location; } if (uploadedBackground.Any()) { if (!string.IsNullOrEmpty(itemBlock.BackgroundUrl)) { removeImages.Add($"{HostingEnv.WebRootPath}{itemBlock.BackgroundUrl}"); } itemBlock.BackgroundUrl = uploadedBackground.First().Location; } Context.ItemBlocks.Update(itemBlock); await Context.SaveChangesAsync(); ImageManipulation.Remove(removeImages.ToArray()); return(List()); }
private Style ReadStyle(XElement style) { XElement images = style.XPathSelectElement("images"); Style result = new Style { LauncherTitle = XElementExtender.ReadName(style), LauncherVersion = XElementExtender.ReadString(style, "version"), LauncherWidth = XElementExtender.ReadInteger(style, "width"), LauncherHeight = XElementExtender.ReadInteger(style, "height"), FontColor = XElementExtender.ReadColor(style, "fontColor"), DialogBackgroundColor = XElementExtender.ReadColor(style, "dialogBackgroundColor"), DialogFontColor = XElementExtender.ReadColor(style, "dialogFontColor"), LauncherBackgroundImage = XElementExtender.ReadImage(images, "background") ?? Properties.Resources.filenotfound, LauncherOverlayImage = XElementExtender.ReadImage(images, "overlay") ?? Properties.Resources.filenotfound, ServerOnlineImage = XElementExtender.ReadImage(images, "serverOnline") ?? Properties.Resources.filenotfound, ServerOfflineImage = XElementExtender.ReadImage(images, "serverOffline") ?? Properties.Resources.filenotfound, ServerPlayButtonImage = XElementExtender.ReadImage(images, "buttonPlay") ?? Properties.Resources.filenotfound, ServerInstallButtonImage = XElementExtender.ReadImage(images, "buttonInstall") ?? Properties.Resources.filenotfound, ServerUninstallButtonImage = XElementExtender.ReadImage(images, "buttonUninstall") ?? Properties.Resources.filenotfound, ServerUpdateButtonImage = XElementExtender.ReadImage(images, "buttonUpdate") ?? Properties.Resources.filenotfound, SettingsButtonImage = XElementExtender.ReadImage(images, "buttonSettings") ?? Properties.Resources.filenotfound, RefreshButtonImage = XElementExtender.ReadImage(images, "buttonRefresh") ?? Properties.Resources.filenotfound, ServerPatchNotesButtonImage = XElementExtender.ReadImage(images, "buttonPatchnotes") ?? Properties.Resources.filenotfound }; result.ServerUninstallButtonGrayScaledImage = ImageManipulation.CreateGrayScaledImage(result.ServerUninstallButtonImage as Bitmap); OutputConsole.PrintVerbose(result, 3); return(result); }
/// <summary> /// resizeBitmap /// </summary> /// <param name="creator">ICanvasResourceCreator</param> public void resizeBitmap(ICanvasResourceCreator creator) // Resize the bitMap { var scaledSoftwareBitmap = CanvasBitmap.CreateFromSoftwareBitmap(creator, new SoftwareBitmap(BitmapPixelFormat.Bgra8, (int)128, (int)128)); this.Bitmap = scaledSoftwareBitmap; // Set the scaled bitmap this.Effect = ImageManipulation.img(this.Bitmap); // manipulate the image }
public void InitializeComponents(MeshRenderer ReadImageMat, MeshRenderer WriteImageMat, int CameraIndex) { this.ReadImageMat = ReadImageMat; this.WriteImageMat = WriteImageMat; WebCams = WebCamTexture.devices; if ((WebCams != null) && (WebCams.Length > 0) && CameraIndex != 0) { #if (UNITY_ANDROID || UNITY_IOS || UNITY_WP8 || UNITY_WP8_1) && !UNITY_EDITOR CameraIndex = 1; #endif StreamingCamera = new WebCamTexture(WebCams[CameraIndex - 1].name, 512, 512, 15); StreamingCamera.Play(); this.ReadImageMat.material.mainTexture = StreamingCamera; } int ImageWidth = ReadImageMat.material.mainTexture.width; int ImageHeight = ReadImageMat.material.mainTexture.height; ImageRecognitionOptimized = new ImageManipulation(ImageWidth, ImageHeight); EdgeCalculation = new CalculateEdges(); OpenDatabase = gameObject.AddComponent <OpenFileDatabase>(); LocalizePlate = new PlateLocalization(ImageWidth, ImageHeight, OpenDatabase); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { var vh = holder as ViewHolder; // get Exhibit from displayedExhibitSet at position var exhibit = displayedExhibitSet.ActiveSet.ElementAt(position); // update the holder with new data vh.Name.SetText(exhibit.Name, TextView.BufferType.Normal); var doubleDistance = exhibit.GetDistance(location) * 1000; string distance; if (doubleDistance > 1000) { distance = Math.Round((decimal)doubleDistance / 1000, 2) + "km"; } else { distance = Math.Round((decimal)doubleDistance, 2) + "m"; } //Remove this if not needed vh.View.ContentDescription = exhibit.Id; vh.Distance.SetText(distance, TextView.BufferType.Normal); BitmapDrawable drawable = exhibit.Image.GetDrawable(context, 100, 100); Bitmap bmp = drawable.Bitmap; vh.Image.SetImageBitmap(ImageManipulation.GetCroppedImage(bmp, 100)); }
public async Task <ActionResult> Create([Bind(Include = "Name,Duration,StartAmmount,Picture")] AuctionViewModel auction) { if (ModelState.IsValid) { Db.Auctions.Add(new Auction { Id = Guid.NewGuid().ToString(), Duration = auction.Duration, EndDate = DateTime.Now, StartDate = DateTime.Now, StartAmmount = auction.StartAmmount, CurrentAmmount = auction.StartAmmount, Name = auction.Name, PictureContent = ImageManipulation.StoreImage(ImageManipulation.ResizeImage(ImageManipulation.LoadImage(auction.Picture.InputStream), 600, 600)), Status = Auction.AuctionStatus.READY, User = await UserManager.FindByIdAsync(User.Identity.GetUserId()), Currency = Db.Params.Find("C").Value, CurrencyPrice = decimal.Parse(Db.Params.Find("T").Value) }); await Db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(auction)); }
private Server ReadServer(XElement server) { XElement images = server.XPathSelectElement("style/images"); XElement launcherProfile = server.XPathSelectElement("launcherProfile"); XElement options = server.XPathSelectElement("options"); Server result = new Server { Name = XElementExtender.ReadName(server), Version = XElementExtender.ReadString(server, "version"), Ip = XElementExtender.ReadString(server, "server/url"), State = XElementExtender.ReadString(server, "state"), StatusUri = XElementExtender.ReadUri(server, "status"), PatchNotesUri = XElementExtender.ReadUri(server, "patchnotesUrl"), PatchFilesUri = XElementExtender.ReadUri(server, "patchUrl"), Image = XElementExtender.ReadImage(images, "background") ?? Properties.Resources.filenotfound, LauncherProfileData = ReadLauncherProfileData(launcherProfile), Options = ReadOptions(options) }; result.GrayScaledImage = ImageManipulation.CreateGrayScaledImage(result.Image as Bitmap); OutputConsole.PrintVerbose(result, 1); return(result); }
public override System.Drawing.Bitmap GetAsBmp(float[] rawValues) { ImageFloat img = new ImageFloat(); ImageManipulation.Vector2Image(rawValues, ref img, w, h); return(img.toBmp()); }
private Employees GetObject() { Employees employee = new Employees(); employee.EmployeeId = (this.IsUpdate)?this.EmployeeId:(Convert.ToInt32(EmployeeIdTextBox.Text.Trim())); employee.FullName = FullNameTextBox.Text.Trim(); employee.DateOfBirth = DOBdateTimePicker.Value.Date; employee.NICNumber = NICTextBox.Text.Trim(); employee.EmailAddress = EmailAddressTextBox.Text.Trim(); employee.Mobile = MobileTextBox.Text.Trim(); employee.Telephone = TelephoneTextBox.Text.Trim(); employee.GenderId = (GenderComboBox.SelectedIndex == -1) ? 0 : Convert.ToInt32(GenderComboBox.SelectedValue); employee.BranchId = (BranchComboBox.SelectedIndex == -1) ? 0 : Convert.ToInt32(BranchComboBox.SelectedValue); employee.EmploymentDate = EmploymentDatedateTimePicker.Value.Date; employee.Photo = (EmployeePictureBox.Image == null) ? null : ImageManipulation.GetPhoto(EmployeePictureBox); employee.AddressLine = AddressLineTextBox.Text.Trim(); employee.CityId = (CityComboBox.SelectedIndex == -1) ? 0 : Convert.ToInt32(CityComboBox.SelectedValue); employee.DistrictId = (DistrictComboBox.SelectedIndex == -1) ? 0 : Convert.ToInt32(DistrictComboBox.SelectedValue); employee.PostCode = PostCodeTextBox.Text.Trim(); employee.JObTitleId = (JobTitleComboBox.SelectedIndex == -1) ? 0 : Convert.ToInt32(JobTitleComboBox.SelectedValue); employee.CurrentSalary = Convert.ToDecimal(CurrentSalaryTextBox1.Text); employee.StartingSalary = Convert.ToDecimal(StartingSalaryTextBox.Text); employee.HasLeft = (HasLeftComboBox.Text == "Yes") ? true : false; employee.DateLeft = DateLeftDateTimePicker.Value.Date; employee.ReasonLeftId = (ReasonLeftComboBox.SelectedIndex == -1) ? 0 : Convert.ToInt32(ReasonLeftComboBox.SelectedValue); employee.Comments = CommentsTextBox.Text.Trim(); employee.CreatedBy = LoggedInUsers.UserName; return(employee); }
private void cmdResize_Click(object sender, EventArgs e) { var newSize = new Size(); if (rbtStatic.Checked) { newSize = new Size(Convert.ToInt32(txtWidthStatic.Text), Convert.ToInt32(txtHeightStatic.Text)); } else if (rbtPercent.Checked) { var width = Convert.ToDouble(Convert.ToDouble(MyPicture.Size.Width) / 100); width = width * Convert.ToDouble(txtPercentWidth.Text); width = Math.Round(width); var height = Convert.ToDouble(Convert.ToDouble(MyPicture.Size.Height) / 100); height = height * Convert.ToDouble(txtPercentHeight.Text); height = Math.Round(height); newSize = new Size(Convert.ToInt32(width), Convert.ToInt32(height)); } Image newImage = ImageManipulation.ResizeImage(MyForm.pictureBox1.Image, newSize); if (newImage != null) { MyForm.pictureBox1.Image = newImage; } else { MessageBox.Show(@"TornadoCapture v3", @"Error Resizing Image! Maybe new Image is too big!", MessageBoxButtons.OK, MessageBoxIcon.Error); } Close(); }
private void GotVCard(object sender, jabber.protocol.client.IQ iq, object data) { jabber.protocol.iq.VCard vcard = (jabber.protocol.iq.VCard)iq.Query; if (iq.Type != jabber.protocol.client.IQType.result) { return; } PopulateName(vcard); PopulateAddresses(vcard); PopulateTelephones(vcard); EmailLink.Text = vcard.Email; CommentTextBox.Text = vcard.Description; if (vcard.Url != null) { WebLink.Text = vcard.Url.ToString(); } PhotoPictureBox.Image = XmppImages.DefaultAvatar; if (vcard.Photo != null) { if (vcard.Photo["BINVAL"] != null) { PhotoPictureBox.Image = ImageManipulation.Base64ToImage(vcard.Photo["BINVAL"].InnerText); } } Spinner.Visible = false; }
private void StudentForm_Load(object sender, EventArgs e) { LoadDataIntoComboBoxes(); if (this.IsUpdate) { DbSqlServer db = new DbSqlServer(AppSettings.ConnectionString()); DataTable dtBranch = db.GetDataList("usp_StudentsGetAllStudentByStudentId", new DbParameter() { Parameter = "@StudentId", Value = this.StudentId }); DataRow row = dtBranch.Rows[0]; StudentIdTextBox.Text = row["StudentId"].ToString(); FullNameTextBox.Text = row["FullName"].ToString(); FatherNameTextBox.Text = row["FatherName"].ToString(); MotherNameTextBox.Text = row["MotherName"].ToString(); DOBDateTimePicker.Text = row["DOB"].ToString(); AddressTextBox.Text = row["Address"].ToString(); EmailTextBox.Text = row["Email"].ToString(); AdmissionDateDateTimePicker.Text = row["AdmissionDate"].ToString(); MobileTextBox.Text = row["Mobile"].ToString(); BloodGroupTextBox.Text = row["BloodGroup"].ToString(); GenderComboBox.SelectedValue = row["GenderId"]; BranchComboBox.SelectedValue = row["BranchId"]; ImagepictureBox.Image = (row["Photo"] is DBNull) ? null : ImageManipulation.PutPhoto((byte[])row["Photo"]); } else { GenerateStudentId(); } }
/// <summary> /// Write the perceived value on the yarp port. /// </summary> public override void WritePerceivedValue() { ImageFloat img = portPerceived.prepare(); ImageManipulation.Vector2Image(PerceivedValue, ref img, w, h); portPerceived.write(); }
public MainWindow() { InitializeComponent(); LOGGER.GetInstance.MessageAvailable += GetInstance_MessageAvailable; //LOGGER.GetInstance.MessageLevel = log4net.Core.Level.Debug; frameWatch = new Stopwatch(); // Init Audio Theme Box cbxAudioTheme.ItemsSource = Enum.GetValues(typeof(SumoEnumGenerated.Theme_theme)).Cast <SumoEnumGenerated.Theme_theme>(); //cbxWifiBand.SelectedIndex = 1; // Init Default UI panelJump.IsEnabled = false; panelSettings.IsEnabled = false; image.IsEnabled = false; // Set SplashImage Assembly _assembly = Assembly.GetExecutingAssembly(); SplashImage = BitmapConverter.ToMat(new Bitmap(_assembly.GetManifestResourceStream("SumoApplication.Images.SplashScreen.jpg"))); // add HUD logo on Splash Image for testing Mat FinalImage = ImageManipulation.Decorate(SplashImage, new SumoInformations()); image.Source = FinalImage.ToWriteableBitmap(); InitDrone(); }
public async Task <IActionResult> Remove(long id) { var itemBlock = Context.ItemBlocks.SingleOrDefault(w => w.Id == id); if (itemBlock == null) { return(List()); } var removeFiles = new List <string>(); if (!string.IsNullOrEmpty(itemBlock.LogoUrl)) { removeFiles.Add($"{HostingEnv.WebRootPath}{itemBlock.LogoUrl}"); } if (!string.IsNullOrEmpty(itemBlock.BackgroundUrl)) { removeFiles.Add($"{HostingEnv.WebRootPath}{itemBlock.BackgroundUrl}"); } Context.ItemBlocks.RemoveRange(itemBlock); await Context.SaveChangesAsync(); ImageManipulation.Remove(removeFiles.ToArray()); return(List()); }
/// <summary> /// Processes a ScreenShot and creates an Ambilight Effect for the keyboard /// </summary> /// <param name="newImage">ScreenShot</param> public void Process(Bitmap newImage) { Bitmap map = ImageManipulation.ResizeImage(newImage, _settings.KeyboardWidth, _settings.KeyboardHeight, _settings.UltrawideModeEnabled); map = ImageManipulation.ApplySaturation(map, _settings.Saturation); ApplyPictureToGrid(map); _chroma.Keyboard.SetCustomAsync(_keyboardGrid); }
/// <summary> /// Processes a ScreenShot and creates an Ambilight Effect for the keypad /// </summary> /// <param name="newImage">ScreenShot</param> public void Process(Bitmap newImage) { Bitmap map = ImageManipulation.ResizeImage(newImage, KeypadConstants.MaxColumns, KeypadConstants.MaxRows, _settings.UltrawideModeEnabled); map = ImageManipulation.ApplySaturation(map, _settings.Saturation); ApplyPictureToGrid(map); _chroma.Keypad.SetCustomAsync(_keypadGrid); }
/// <summary> /// Read the real value on the yarp port. /// Convert the image into a vector. /// </summary> public override void ReadRealValue() { ImageFloat img = portReal.read(isBlockingRead); if (img != null) { RealValue = ImageManipulation.Image2Vector(Crop(img), w, h); } }
private Bitmap DecodeImage(string ImageBase64Encoded) { if (_Image == null && !string.IsNullOrEmpty(ImageBase64Encoded)) { _Image = ImageManipulation.DecodeImage(ImageBase64Encoded); } return(_Image); }
public void Process(Bitmap newImage) { Bitmap mapHeadset = ImageManipulation.ResizeImage(newImage, 2, 1); mapHeadset = ImageManipulation.ApplySaturation(mapHeadset, _settings.Saturation); ApplyPictureToGrid(mapHeadset); _chroma.Headset.SetCustomAsync(_headsetGrid); mapHeadset.Dispose(); }
public CreateWebsite(string name, string url, List <string> categories, ImageManipulation image, string email, string password) : base(name, url, categories, image, email, password) { }
public static void Main() { List <string> cardImagesURLs = ImageManipulation.ExtractImagesfromUrl("https://mgtechtest.blob.core.windows.net/files/showcase.json"); foreach (string cardImageURL in cardImagesURLs) { Console.WriteLine(cardImageURL); } }
/// <summary> /// Processes a ScreenShot and creates an Ambilight Effect for the keyboard /// </summary> /// <param name="newImage">ScreenShot</param> internal void Process(Bitmap newImage) { Bitmap map = ImageManipulation.ResizeImage(newImage, settings.KeyboardWidth, settings.KeyboardHeight, settings.UltrawideModeBool); map = ImageManipulation.ApplySaturation(map, settings.Saturation); _keyboardGrid = KeyboardCustom.Create(); _keyboardGrid = GenerateKeyboardGrid(map, _keyboardGrid); Chroma.Instance.Keyboard.SetCustom(_keyboardGrid); }
void timer_Tick(object sender, EventArgs e) { ImageRgb img = activity.read(false); if (img != null) { m_activity.Image = ImageManipulation.toBmp(img); } }
public static string UploadAvatar(ImageManipulation img, string id) { string pathAvatar; HMACMD5 md5 = new HMACMD5(NimbusConfig.GeneralHMACKey); var nomeImgAvatar = "avatar-" + id; md5.ComputeHash(Encoding.Unicode.GetBytes(nomeImgAvatar)); var nomeHashExt = Base32.ToString(md5.Hash).ToLower() + ".jpg"; nomeImgAvatar = "av130x130/" + nomeHashExt; var nomeImgAvatar180x100 = "av180x100/" + nomeHashExt; var nomeImgAvatar35x35 = "av35x35/" + nomeHashExt; var nomeImgAvatar60x60 = "av60x60/" + nomeHashExt; //envia as imagens redimensionadas Task <string> img1 = Task.Run(() => { var clone = new ImageManipulation(img); clone.FitSize(200, 200); //muito embora a url é av130x130, o tamanho do avatar é 200x200. var blob = new AzureBlob(Const.Azure.AvatarContainer, nomeImgAvatar); blob.UploadStreamToAzure(clone.SaveToJpeg()); return(blob.BlockBlob.Uri.AbsoluteUri.Replace("https://", "http://").Replace("***REMOVED***", "storage.portalnimbus.com.br")); }); Task <string> img2 = Task.Run(() => { var clone = new ImageManipulation(img); clone.FitSize(180, 100); var blob180x100 = new AzureBlob(Const.Azure.AvatarContainer, nomeImgAvatar180x100); blob180x100.UploadStreamToAzure(clone.SaveToJpeg()); return(string.Empty); }); Task <string> img3 = Task.Run(() => { var clone = new ImageManipulation(img); clone.FitSize(60, 60); var blob60x60 = new AzureBlob(Const.Azure.AvatarContainer, nomeImgAvatar60x60); blob60x60.UploadStreamToAzure(clone.SaveToJpeg()); return(string.Empty); }); Task <string> img4 = Task.Run(() => { var clone = new ImageManipulation(img); clone.FitSize(35, 35); var blob35x35 = new AzureBlob(Const.Azure.AvatarContainer, nomeImgAvatar35x35); blob35x35.UploadStreamToAzure(clone.SaveToJpeg()); return(string.Empty); }); Task.WaitAll(img1, img2, img3, img4); pathAvatar = img1.Result; return(pathAvatar); }
/// <summary> /// Processes a ScreenShot and creates an Ambilight Effect for the mousepad /// </summary> /// <param name="newImage">ScreenShot</param> public void Process(Bitmap newImage) { Bitmap mapMousePad = ImageManipulation.ResizeImage(newImage, 7, 6); mapMousePad = ImageManipulation.ApplySaturation(mapMousePad, _settings.Saturation); ApplyPictureToGrid(mapMousePad); _chroma.Mousepad.SetCustomAsync(_mousepadGrid); mapMousePad.Dispose(); }
/// <summary> /// Processes a ScreenShot and creates an Ambilight Effect for the mouse /// </summary> /// <param name="newImage">ScreenShot</param> public void Process(Bitmap newImage) { Bitmap mapMouse = ImageManipulation.ResizeImage(newImage, MouseConstants.MaxColumns, MouseConstants.MaxRows); mapMouse = ImageManipulation.ApplySaturation(mapMouse, _settings.Saturation); ApplyPictureToGrid(mapMouse); _chroma.Mouse.SetGridAsync(_mouseGrid); mapMouse.Dispose(); }
void timer_Tick(object sender, EventArgs e) { for (int i = 0; i < r_l; i++) { ImageRgb img = layersActivity[i].read(false); if (img != null) { m_layers[i].Image = ImageManipulation.toBmp(img); } } }
/// <summary> /// Processes a ScreenShot and creates an Ambilight Effect for the mouse /// </summary> /// <param name="newImage">ScreenShot</param> internal void Process(Bitmap newImage) { var mouseGrid = Corale.Colore.Razer.Mouse.Effects.CustomGrid.Create(); Bitmap mapMouse = ImageManipulation.ResizeImage(newImage, Corale.Colore.Razer.Mouse.Constants.MaxColumns, Corale.Colore.Razer.Mouse.Constants.MaxRows); mapMouse = ImageManipulation.ApplySaturation(mapMouse, settings.Saturation); mouseGrid = GenerateMouseGrid(mapMouse, mouseGrid); Chroma.Instance.Mouse.SetGrid(mouseGrid); mapMouse.Dispose(); }
private void OnMouseHover(object sender, EventArgs e) { UpdateCursor(); if (IsBusy()) { return; } (sender as PictureBox).Image = ImageManipulation.CreateLightedImage((sender as PictureBox).Image as Bitmap, 50); }