jpegbitmapencoder

How to save image using JpegBitmapEncoder

本小妞迷上赌 提交于 2019-12-13 19:43:34
问题 According to the image encoding example here I should be able to use JpegBitmapEncoder to encode an image for saving as a jpeg file but get this compile error: error CS1503: Argument 1: cannot convert from 'System.Windows.Controls.Image' to 'System.Uri' I don't see a way (property or method in Image) to get System.Uri from Image. What am I missing? The Image xaml code is <Image Name="ColorImage"/> The SaveImage C# is ... SaveImage(ColorImage, path); ... private void SaveImage(Image image,

save an image from ink canvas

喜你入骨 提交于 2019-12-11 11:59:04
问题 I am trying to save an image from ink canvas however it does not create any file after saving, this is my code RenderTargetBitmap rtb = new RenderTargetBitmap( (int)canvas.Width, (int)canvas.Height, 0, 0, PixelFormats.Default); rtb.Render(this.canvas); JpegBitmapEncoder encoder = new JpegBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(rtb)); using(var file = new FileStream(@"C:\test.jpg", FileMode.Create)) { encoder.Save(file); } however it does not create any file even when I change

Windows update KB4040972/73 causes black images with WPF classes

你说的曾经没有我的故事 提交于 2019-12-05 18:39:07
问题 I have an application relying on Deep zoom images (convertion from a PNG to a pyramid of JPGs in various scale) which we use DeepZoomTools.dll for. This is relying on PresentationCore.dll and has been working fine for years. After the rollout of KB4040972 and KB4040973, the conversion from PNG to JPG generates (depending on coordinates) black images instead of the image it should contain. If the below code is run in a console or desktop app, it works. It ONLY doesn't work if run under high

Windows update KB4040972/73 causes black images with WPF classes

我与影子孤独终老i 提交于 2019-12-04 03:07:43
I have an application relying on Deep zoom images (convertion from a PNG to a pyramid of JPGs in various scale) which we use DeepZoomTools.dll for. This is relying on PresentationCore.dll and has been working fine for years. After the rollout of KB4040972 and KB4040973, the conversion from PNG to JPG generates (depending on coordinates) black images instead of the image it should contain. If the below code is run in a console or desktop app, it works. It ONLY doesn't work if run under high privilege SYSTEM account (e.g. from Task scheduler). I have created a project to reproduce the issue,