Compress image size in c# wpf

There is a file format jpg, weight need to reduce msdn.microsoft.com/en-us/library/ytz20d80.aspx on wpf there is no System.Drawing how to be?
October 8th 19 at 02:53
2 answers
October 8th 19 at 02:55
Solution
Uri myUri = new Uri("C:\\1\\HDPackSuperiorWallpapers276_011.jpg", UriKind.RelativeOrAbsolute);
JpegBitmapDecoder decoder2 = new JpegBitmapDecoder(myUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource2 BitmapSource = decoder2.Frames[0];

// Draw the Image
Image myImage2 = new Image();
myImage2.Source = bitmapSource2;
myImage2.Stretch = Stretch.None;
myImage2.Margin = new Thickness(20);

FileStream stream = new FileStream("C:\\1\\new.jpg", FileMode.Create);
JpegBitmapEncoder encoder = new JpegBitmapEncoder();
TextBlock myTextBlock = new TextBlock();
myTextBlock.Text = "Codec Author is:" + encoder.CodecInfo.Author.ToString();
encoder.Frames.Add(BitmapFrame.Create(bitmapSource2));
encoder.Save(stream);

With 900kb -> 300, but I do not understand something, where is the level of compression is?
encoder.QualityLevel = 30; - Wellington.Will commented on October 8th 19 at 02:58
October 8th 19 at 02:57
in wpf there is no System.Drawing how to be?


Can I something not so understood, but:





And you have a System.Drawing in WPF.
thanks, but I already did without the System.Drawing - Wellington.Will commented on October 8th 19 at 03:00

Find more questions by tags WPFProgrammingC