JpegBitmapEncoder Class
.NET Framework 3.0
Defines an encoder that is used to encode Joint Photographics Experts Group (JPEG) format images. This class cannot be inherited.
Namespace: System.Windows.Media.Imaging
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
Joint Photographics Experts Group (JPEG) format bitmaps support frame level thumbnails and frame level metadata. They do not support preview, global thumbnails, global metadata, or multiple frames.
Encoding does not work in partial trust. See the Windows Presentation Foundation Partial Trust Programming topic for information on partial trust.
The following example demonstrates how to use the JpegBitmapEncoder to encode a new bitmap image.
Dim width As Integer = 128 Dim height As Integer = width Dim stride As Integer = CType(width / 8, Integer) Dim pixels(height * stride) As Byte ' Define the image palette Dim myPalette As BitmapPalette = BitmapPalettes.Halftone256 ' Creates a new empty image with the pre-defined palette Dim image As BitmapSource = System.Windows.Media.Imaging.BitmapSource.Create(width, height, 96, 96, PixelFormats.Indexed1, myPalette, pixels, stride) Dim stream As New FileStream("new.jpg", FileMode.Create) Dim encoder As New JpegBitmapEncoder() Dim myTextBlock As New TextBlock() myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString() encoder.FlipHorizontal = True encoder.FlipVertical = False encoder.QualityLevel = 30 encoder.Rotation = Rotation.Rotate90 encoder.Frames.Add(BitmapFrame.Create(image)) encoder.Save(stream)
System.Object
System.Windows.Threading.DispatcherObject
System.Windows.Media.Imaging.BitmapEncoder
System.Windows.Media.Imaging.JpegBitmapEncoder
System.Windows.Threading.DispatcherObject
System.Windows.Media.Imaging.BitmapEncoder
System.Windows.Media.Imaging.JpegBitmapEncoder
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: