private void MainPage_Loaded(object sender, RoutedEventArgs e) { // Initialize Composition UI infrastructure. _root = Container.GetVisual(); _compositor = _root.Compositor; _imageFactory = CompositionImageFactory.CreateCompositionImageFactory(_compositor); // Hook the sprite visual into the XAML visual tree. _spriteVisual = _compositor.CreateSpriteVisual(); var side = (float)Math.Min(Presenter.ActualWidth, Presenter.ActualHeight); _spriteVisual.Size = new Vector2(side, side); _root.Children.InsertAtTop(_spriteVisual); // Create the effect, but don't specify the properties yet. var temperatureAndTintEffect = new TemperatureAndTintEffect { Name = "temperatureAndtint", Source = new CompositionEffectSourceParameter("source") }; // Strongly typed version of the "temperatureAndtint.Temperature" string _temperatureParameter = temperatureAndTintEffect.Name + "." + nameof(temperatureAndTintEffect.Temperature); // Compile the effect var effectFactory = _compositor.CreateEffectFactory( temperatureAndTintEffect, new[] { _temperatureParameter, "temperatureAndtint.Tint" }); // Create and apply the brush. _brush = effectFactory.CreateBrush(); _spriteVisual.Brush = _brush; ColorWheelButton.IsChecked = true; }
private void Load_Completed(LoadedImageSurface sender, LoadedImageSourceLoadCompletedEventArgs e) { IsImageLoading = false; if (e.Status == LoadedImageSourceLoadStatus.Success) { var compositor = Window.Current.Compositor; var brush = compositor.CreateSurfaceBrush(_surface); brush.Stretch = CompositionStretch.UniformToFill; // Create effects chain. saturationEffect = new SaturationEffect() { Name = "SaturationEffect", Saturation = (float)SaturationAmount, Source = new CompositionEffectSourceParameter("image") }; contrastEffect = new ContrastEffect() { Name = "ContrastEffect", Contrast = (float)ContrastAmount, Source = saturationEffect }; exposureEffect = new ExposureEffect() { Name = "ExposureEffect", Source = contrastEffect, Exposure = (float)ExposureAmount, }; temperatureAndTintEffect = new TemperatureAndTintEffect() { Name = "TemperatureAndTintEffect", Source = exposureEffect, Temperature = (float)TemperatureAmount, Tint = (float)TintAmount }; graphicsEffect = new GaussianBlurEffect() { Name = "Blur", Source = temperatureAndTintEffect, BlurAmount = (float)BlurAmount, BorderMode = EffectBorderMode.Hard, }; var graphicsEffectFactory = compositor.CreateEffectFactory(graphicsEffect, new[] { "SaturationEffect.Saturation", "ExposureEffect.Exposure", "Blur.BlurAmount", "TemperatureAndTintEffect.Temperature", "TemperatureAndTintEffect.Tint", "ContrastEffect.Contrast" }); combinedBrush = graphicsEffectFactory.CreateBrush(); combinedBrush.SetSourceParameter("image", brush); // Composition Brush is what is being applied to the UI Element. CompositionBrush = combinedBrush; } else { LoadImageFromPath("ms-appx:///Assets/StoreLogo.png"); } }
private void InitializeEffects() { saturationEffect = new SaturationEffect() { Name = "SaturationEffect", Saturation = item.Saturation, Source = new CompositionEffectSourceParameter("Backdrop") }; contrastEffect = new ContrastEffect() { Name = "ContrastEffect", Contrast = item.Contrast, Source = saturationEffect }; exposureEffect = new ExposureEffect() { Name = "ExposureEffect", Source = contrastEffect, Exposure = item.Exposure, }; temperatureAndTintEffect = new TemperatureAndTintEffect() { Name = "TemperatureAndTintEffect", Source = exposureEffect, Temperature = item.Temperature, Tint = item.Tint }; graphicsEffect = new GaussianBlurEffect() { Name = "Blur", Source = temperatureAndTintEffect, BlurAmount = item.Blur, BorderMode = EffectBorderMode.Hard, }; }
private ICanvasImage ApplyFilterTemplate(ICanvasImage source) { if (_filter_index == 0) //无滤镜 { return(source); } else if (_filter_index == 3) // 黑白 { return(new GrayscaleEffect { Source = source }); } else if (_filter_index == 1) //反色 { return(new InvertEffect { Source = source }); } else if (_filter_index == 2) //冷淡 { var hueRotationEffect = new HueRotationEffect { Source = source, Angle = 0.5f }; return(hueRotationEffect); } else if (_filter_index == 4) //美食 { var temperatureAndTintEffect = new TemperatureAndTintEffect { Source = source }; temperatureAndTintEffect.Temperature = 0.6f; temperatureAndTintEffect.Tint = 0.6f; return(temperatureAndTintEffect); } else if (_filter_index == 5) //雕刻 { var embossEffect = new EmbossEffect { Source = source }; embossEffect.Amount = 5; embossEffect.Angle = 0; return(embossEffect); } else { return(source); } }
public CanvasRenderTarget applyHueRotationEffects(CanvasBitmap workingBitmap) { //CanvasBitmap workingBitmap = SelectWorkingBitmap(useOriginalBitmap); if (workingBitmap != null) { int ww = (int)workingBitmap.SizeInPixels.Width; int hh = (int)workingBitmap.SizeInPixels.Height; TemperatureAndTintEffect temperatureAndTintEffect = new TemperatureAndTintEffect(); temperatureAndTintEffect.Source = workingBitmap; temperatureAndTintEffect.Temperature = (float)hueTemperature; temperatureAndTintEffect.Tint = (float)hueTint; HueRotationEffect hueRotationEffect = new HueRotationEffect(); hueRotationEffect.Angle = (float)hueRotationAngle; hueRotationEffect.Source = temperatureAndTintEffect; PosterizeEffect posterizeEffect = null; EdgeDetectionEffect edgeDetectionEffect = null; if (hueDoPosterize) { posterizeEffect = new PosterizeEffect(); posterizeEffect.Source = hueRotationEffect; posterizeEffect.RedValueCount = huePosterizeRedCount; posterizeEffect.BlueValueCount = huePosterizeBlueCount; posterizeEffect.GreenValueCount = huePosterizeGreenCount; edgeDetectionEffect = new EdgeDetectionEffect(); edgeDetectionEffect.Source = posterizeEffect; edgeDetectionEffect.Amount = (float)0.9; edgeDetectionEffect.BlurAmount = 1; edgeDetectionEffect.OverlayEdges = true; } //if (canvasRenderTarget != null) // canvasRenderTarget.Dispose(); CanvasRenderTarget canvasRenderTarget = new CanvasRenderTarget(CanvasDevice.GetSharedDevice(), ww, hh, canvasBitmap.Dpi); using (var session = canvasRenderTarget.CreateDrawingSession()) { if (hueDoPosterize) { //session.DrawImage(posterizeEffect); session.DrawImage(edgeDetectionEffect); } else { session.DrawImage(hueRotationEffect); } } return(canvasRenderTarget); } return(null); }
public ICanvasImage ApplyFilter(ICanvasImage source) { var temperatureAndTintEffect = new TemperatureAndTintEffect { Source = source }; temperatureAndTintEffect.Temperature = 0.7f; temperatureAndTintEffect.Tint = 0.7f; return(temperatureAndTintEffect); }
async Task <Uri> Temperature(int EffectPercentage) { using (var source = new StorageFileImageSource(imageStorageFile)) using (var contrastEffect = new ContrastEffect(source) { Level = 0.6 }) using (var sharpnessEffect = new TemperatureAndTintEffect(contrastEffect) { Temperature = (EffectPercentage / 100) }) { LastEffect = sharpnessEffect; return(await SaveToImage()); } }
private ICanvasImage CreateTemperatureAndTint() { textLabel = requiresWin10; var temperatureAndTintEffect = new TemperatureAndTintEffect { Source = bitmapTiger }; // Animation adjusts the temperature and tint of the image. animationFunction = elapsedTime => { temperatureAndTintEffect.Temperature = (float)Math.Sin(elapsedTime * 0.9); temperatureAndTintEffect.Tint = (float)Math.Sin(elapsedTime * 2.3); }; return(temperatureAndTintEffect); }
private void MainGridLoaded(object sender, RoutedEventArgs e) { m_compositor = ElementCompositionPreview.GetElementVisual(MainGrid).Compositor; m_root = m_compositor.CreateContainerVisual(); ElementCompositionPreview.SetElementChildVisual(MainGrid, m_root); Size imageSize; m_noEffectBrush = CreateBrushFromAsset( "Bruno'sFamily2015 (13)-X2.jpg", out imageSize); m_imageAspectRatio = (imageSize.Width == 0 && imageSize.Height == 0) ? 1 : imageSize.Width / imageSize.Height; m_sprite = m_compositor.CreateSpriteVisual(); ResizeImage(new Size(MainGrid.ActualWidth, MainGrid.ActualHeight)); m_root.Children.InsertAtTop(m_sprite); // Image with alpha channel as an mask. var alphaMaskEffectDesc = new CompositeEffect { Mode = CanvasComposite.DestinationIn, Sources = { new CompositionEffectSourceParameter("Image"), new Transform2DEffect { Name = "MaskTransform", Source = new CompositionEffectSourceParameter("Mask") } } }; m_alphaMaskEffectBrush = m_compositor.CreateEffectFactory( alphaMaskEffectDesc, new[] { "MaskTransform.TransformMatrix" } ).CreateBrush(); m_alphaMaskEffectBrush.SetSourceParameter( "Image", m_noEffectBrush); m_alphaMaskEffectBrush.SetSourceParameter( "Mask", CreateBrushFromAsset("CircleMask.png")); // Arithmetic operations between two images. var arithmeticEffectDesc = new ArithmeticCompositeEffect { Name = "effect", ClampOutput = false, Source1 = new CompositionEffectSourceParameter("Source1"), Source2 = new CompositionEffectSourceParameter("Source2") }; m_arithmeticEffectBrush = m_compositor.CreateEffectFactory( arithmeticEffectDesc, new[] { "effect.MultiplyAmount", "effect.Source1Amount", "effect.Source2Amount", "effect.Offset" } ).CreateBrush(); m_arithmeticEffectBrush.SetSourceParameter( "Source1", m_noEffectBrush); m_arithmeticEffectBrush.SetSourceParameter( "Source2", CreateBrushFromAsset("_P2A8041.jpg")); // Creates a blend effect that combines two images. var foregroundBrush = CreateBrushFromAsset("Checkerboard_100x100.png"); m_blendEffectBrushes = new CompositionEffectBrush[m_supportedBlendModes.Length]; for (int i = 0; i < m_supportedBlendModes.Length; i++) { var blendEffectDesc = new BlendEffect { Mode = m_supportedBlendModes[i], Background = new CompositionEffectSourceParameter("Background"), Foreground = new CompositionEffectSourceParameter("Foreground") }; m_blendEffectBrushes[i] = m_compositor.CreateEffectFactory( blendEffectDesc ).CreateBrush(); m_blendEffectBrushes[i].SetSourceParameter( "Background", m_noEffectBrush); m_blendEffectBrushes[i].SetSourceParameter( "Foreground", foregroundBrush); } // Generates an image containing a solid color. var colorSourceEffectDesc = new ColorSourceEffect // FloodEffect { Name = "effect" }; m_colorSourceEffectBrush = m_compositor.CreateEffectFactory( colorSourceEffectDesc, new[] { "effect.Color" } ).CreateBrush(); // Changes the contrast of an image. var contrastEffectDesc = new ContrastEffect { Name = "effect", Source = new CompositionEffectSourceParameter("Image") }; m_contrastEffectBrush = m_compositor.CreateEffectFactory( contrastEffectDesc, new[] { "effect.Contrast" } ).CreateBrush(); m_contrastEffectBrush.SetSourceParameter( "Image", m_noEffectBrush); // Changes the exposure of an image. var exposureEffectDesc = new ExposureEffect { Name = "effect", Source = new CompositionEffectSourceParameter("Image") }; m_exposureEffectBrush = m_compositor.CreateEffectFactory( exposureEffectDesc, new[] { "effect.Exposure" } ).CreateBrush(); m_exposureEffectBrush.SetSourceParameter( "Image", m_noEffectBrush); // Alters the colors of an image by applying a per-channel gamma transfer function. var gammaTransferEffectDesc = new GammaTransferEffect { Name = "effect", RedDisable = false, GreenDisable = false, BlueDisable = false, AlphaDisable = false, Source = new CompositionEffectSourceParameter("Image") }; m_gammaTransferEffectBrush = m_compositor.CreateEffectFactory( gammaTransferEffectDesc, new[] { "effect.RedAmplitude", "effect.RedExponent", "effect.RedOffset", "effect.GreenAmplitude", "effect.GreenExponent", "effect.GreenOffset", "effect.BlueAmplitude", "effect.BlueExponent", "effect.BlueOffset" } ).CreateBrush(); m_gammaTransferEffectBrush.SetSourceParameter( "Image", m_noEffectBrush); // Converts an image to monochromatic gray. var grayscaleEffectDesc = new GrayscaleEffect { Name = "effect", Source = new CompositionEffectSourceParameter("Image") }; m_grayscaleEffectBrush = m_compositor.CreateEffectFactory( grayscaleEffectDesc ).CreateBrush(); m_grayscaleEffectBrush.SetSourceParameter( "Image", m_noEffectBrush); // Alters the color of an image by rotating its hue values. var hueRotationEffectDesc = new HueRotationEffect { Name = "effect", Source = new CompositionEffectSourceParameter("Image") }; m_hueRotationEffectBrush = m_compositor.CreateEffectFactory( hueRotationEffectDesc, new[] { "effect.Angle" } ).CreateBrush(); m_hueRotationEffectBrush.SetSourceParameter( "Image", m_noEffectBrush); // Inverts the colors of an image. var invertEffectDesc = new InvertEffect { Name = "effect", Source = new CompositionEffectSourceParameter("Image") }; m_invertEffectBrush = m_compositor.CreateEffectFactory( invertEffectDesc ).CreateBrush(); m_invertEffectBrush.SetSourceParameter( "Image", m_noEffectBrush); // Alters the saturation of an image. var saturationEffectDesc = new SaturationEffect { Name = "effect", Source = new CompositionEffectSourceParameter("Image") }; m_saturateEffectBrush = m_compositor.CreateEffectFactory( saturationEffectDesc, new[] { "effect.Saturation" } ).CreateBrush(); m_saturateEffectBrush.SetSourceParameter( "Image", m_noEffectBrush); // Converts an image to sepia tones. var supportedAlphaModes = new[] { CanvasAlphaMode.Premultiplied, CanvasAlphaMode.Straight }; m_sepiaEffectBrushes = new CompositionEffectBrush[supportedAlphaModes.Length]; for (int i = 0; i < supportedAlphaModes.Length; i++) { var sepiaEffectDesc = new SepiaEffect { Name = "effect", AlphaMode = supportedAlphaModes[i], Source = new CompositionEffectSourceParameter("Image") }; m_sepiaEffectBrushes[i] = m_compositor.CreateEffectFactory( sepiaEffectDesc, new[] { "effect.Intensity" } ).CreateBrush(); m_sepiaEffectBrushes[i].SetSourceParameter( "Image", m_noEffectBrush); } // Adjusts the temperature and/or tint of an image. var temperatureAndTintEffectDesc = new TemperatureAndTintEffect { Name = "effect", Source = new CompositionEffectSourceParameter("Image") }; m_temperatureAndTintEffectBrush = m_compositor.CreateEffectFactory( temperatureAndTintEffectDesc, new[] { "effect.Temperature", "effect.Tint" } ).CreateBrush(); m_temperatureAndTintEffectBrush.SetSourceParameter( "Image", m_noEffectBrush); // Applies a 2D affine transform matrix to an image. var transform2DEffectDesc = new Transform2DEffect { TransformMatrix = new Matrix3x2( -1, 0, 0, 1, m_sprite.Size.X, 0), Source = new CompositionEffectSourceParameter("Image") }; m_transform2DEffectBrush = m_compositor.CreateEffectFactory( transform2DEffectDesc ).CreateBrush(); m_transform2DEffectBrush.SetSourceParameter( "Image", m_noEffectBrush); // For simplying UI states switch, put effect parameter grids in an array m_effectParamsGrids = new Grid[(int)EffectType.NumEffectTypes]; m_effectParamsGrids[(int)EffectType.NoEffect] = null; m_effectParamsGrids[(int)EffectType.AlphaMask] = AlphaMaskParams; m_effectParamsGrids[(int)EffectType.Arithmetic] = ArithmeticParams; m_effectParamsGrids[(int)EffectType.Blend] = BlendParams; m_effectParamsGrids[(int)EffectType.ColorSource] = ColorSourceParams; m_effectParamsGrids[(int)EffectType.Contrast] = ContrastParams; m_effectParamsGrids[(int)EffectType.Exposure] = ExposureParams; m_effectParamsGrids[(int)EffectType.GammaTransfer] = GammaTransferParams; m_effectParamsGrids[(int)EffectType.Grayscale] = null; m_effectParamsGrids[(int)EffectType.HueRotation] = HueRotationParams; m_effectParamsGrids[(int)EffectType.Invert] = null; m_effectParamsGrids[(int)EffectType.Saturation] = SaturationParams; m_effectParamsGrids[(int)EffectType.Sepia] = SepiaParams; m_effectParamsGrids[(int)EffectType.TemperatureAndTint] = TemperatureAndTintParams; m_effectParamsGrids[(int)EffectType.Transform2D] = null; // Same as grids m_effectBrushes = new CompositionBrush[(int)EffectType.NumEffectTypes]; m_effectBrushes[(int)EffectType.NoEffect] = m_noEffectBrush; m_effectBrushes[(int)EffectType.AlphaMask] = m_alphaMaskEffectBrush; m_effectBrushes[(int)EffectType.Arithmetic] = m_arithmeticEffectBrush; m_effectBrushes[(int)EffectType.Blend] = m_blendEffectBrushes[m_activeBlendMode]; m_effectBrushes[(int)EffectType.ColorSource] = m_colorSourceEffectBrush; m_effectBrushes[(int)EffectType.Contrast] = m_contrastEffectBrush; m_effectBrushes[(int)EffectType.Exposure] = m_exposureEffectBrush; m_effectBrushes[(int)EffectType.GammaTransfer] = m_gammaTransferEffectBrush; m_effectBrushes[(int)EffectType.Grayscale] = m_grayscaleEffectBrush; m_effectBrushes[(int)EffectType.HueRotation] = m_hueRotationEffectBrush; m_effectBrushes[(int)EffectType.Invert] = m_invertEffectBrush; m_effectBrushes[(int)EffectType.Saturation] = m_saturateEffectBrush; m_effectBrushes[(int)EffectType.Sepia] = m_sepiaEffectBrushes[m_activeSepiaAlphaMode]; m_effectBrushes[(int)EffectType.TemperatureAndTint] = m_temperatureAndTintEffectBrush; m_effectBrushes[(int)EffectType.Transform2D] = m_transform2DEffectBrush; this.InitializeValues(); }
private ICanvasImage ApplyFilterTemplate(ICanvasImage source) { if (_filter_index == 0) //无滤镜 { return(source); } else if (_filter_index == 1) // 黑白 { return(new GrayscaleEffect { Source = source }); } else if (_filter_index == 2) //反色 { return(new InvertEffect { Source = source }); } else if (_filter_index == 3) //冷色 { var hueRotationEffect = new HueRotationEffect { Source = source, Angle = 0.5f }; return(hueRotationEffect); } else if (_filter_index == 4) //美食 { var temperatureAndTintEffect = new TemperatureAndTintEffect { Source = source }; temperatureAndTintEffect.Temperature = 0.6f; temperatureAndTintEffect.Tint = 0.6f; return(temperatureAndTintEffect); } else if (_filter_index == 5) //冷绿 { var temperatureAndTintEffect = new TemperatureAndTintEffect { Source = source }; temperatureAndTintEffect.Temperature = -0.6f; temperatureAndTintEffect.Tint = -0.6f; return(temperatureAndTintEffect); } else if (_filter_index == 6) //梦幻 { var vignetteEffect = new VignetteEffect { Source = source }; vignetteEffect.Color = Color.FromArgb(255, 0xFF, 0xFF, 0xFF); vignetteEffect.Amount = 0.6f; return(vignetteEffect); } else if (_filter_index == 7) //浮雕 { var embossEffect = new EmbossEffect { Source = source }; embossEffect.Amount = 5; embossEffect.Angle = 0; return(embossEffect); } else if (_filter_index == 8) //怀旧 { var sepiaEffect = new SepiaEffect { Source = source }; sepiaEffect.Intensity = 1; return(sepiaEffect); } else if (_filter_index == 9)//运动 { var directEffect = new DirectionalBlurEffect { Source = source }; directEffect.BlurAmount = 12; directEffect.BorderMode = EffectBorderMode.Soft; directEffect.Angle = 3.14F; return(directEffect); } else { return(source); } }
private ICanvasImage ApplyFilter(ICanvasImage source) { if (filterIndex == 0) // NONE { return(source); } else if (filterIndex == 1) { return(new GrayscaleEffect { Source = source }); } else if (filterIndex == 2) { return(new InvertEffect { Source = source }); } else if (filterIndex == 3) { var hueRotationEffect = new HueRotationEffect { Source = source, Angle = 0.5f }; return(hueRotationEffect); } else if (filterIndex == 4) { var temperatureAndTintEffect = new TemperatureAndTintEffect { Source = source }; temperatureAndTintEffect.Temperature = 0.6f; temperatureAndTintEffect.Tint = 0.6f; return(temperatureAndTintEffect); } else if (filterIndex == 5) { var temperatureAndTintEffect = new TemperatureAndTintEffect { Source = source }; temperatureAndTintEffect.Temperature = -0.6f; temperatureAndTintEffect.Tint = -0.6f; return(temperatureAndTintEffect); } else if (filterIndex == 6) { var vignetteEffect = new VignetteEffect { Source = source }; vignetteEffect.Color = Color.FromArgb(255, 0xFF, 0xFF, 0xFF); vignetteEffect.Amount = 0.6f; return(vignetteEffect); } else if (filterIndex == 7) { var embossEffect = new EmbossEffect { Source = source }; embossEffect.Amount = 5; embossEffect.Angle = 0; return(embossEffect); } else if (filterIndex == 8) { var sepiaEffect = new SepiaEffect { Source = source }; sepiaEffect.Intensity = 1; return(sepiaEffect); } else // NONE { return(source); } }
private async void btnUpload_Clicked(object sender, RoutedEventArgs e) { FileOpenPicker openPicker = new FileOpenPicker(); openPicker.ViewMode = PickerViewMode.Thumbnail; openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".png"); // Pick only one file once a time StorageFile file = await openPicker.PickSingleFileAsync(); if (file == null) { return; } using (IRandomAccessStream fileStream = await file.OpenAsync(FileAccessMode.Read)) { cl = new CanvasCommandList(canvas); using (CanvasDrawingSession clds = cl.CreateDrawingSession()) { BitmapDecoder decoder = await BitmapDecoder.CreateAsync(fileStream); clds.DrawImage( CanvasBitmap.CreateFromSoftwareBitmap(canvas, await decoder.GetSoftwareBitmapAsync(BitmapPixelFormat.Rgba16, BitmapAlphaMode.Premultiplied))); } blur = new GaussianBlurEffect { Source = cl, BlurAmount = (float)gaussianBlurAmountSlider.Value }; hueRotation = new HueRotationEffect { Source = blur, Angle = (float)hueRotationAmountSlider.Value / 100f * 360f }; contrast = new ContrastEffect { Source = hueRotation, Contrast = (float)(contrastAmountSlider.Value - 50f) / 50f }; saturation = new SaturationEffect { Source = contrast, Saturation = (float)saturationAmountSlider.Value / 100f }; temperatureAndTint = new TemperatureAndTintEffect { Source = saturation, Temperature = (float)(temperatureAmountSlider.Value - 50f) / 50f, Tint = (float)(tintAmountSlider.Value - 50f) / 50f }; grayscale = new GrayscaleEffect { Source = temperatureAndTint }; canvasEffect = saturation; // CanvasControl.Invalidate Method iIndicates that the contents of the CanvasControl need to be redrawn. // Calling Invalidate results in the Draw event being raised shortly afterward. // // Reference: https://microsoft.github.io/Win2D/html/M_Microsoft_Graphics_Canvas_UI_Xaml_CanvasControl_Invalidate.htm canvas.Invalidate(); gaussianBlurAmountSlider.IsEnabled = true; hueRotationAmountSlider.IsEnabled = true; contrastAmountSlider.IsEnabled = true; saturationAmountSlider.IsEnabled = true; temperatureAmountSlider.IsEnabled = true; tintAmountSlider.IsEnabled = true; grayscaleBufferPrevision.IsEnabled = true; var image = new BitmapImage(); await image.SetSourceAsync(fileStream); } }