Exportar (0) Imprimir
Expandir todo

JpegBitmapEncoder (Clase)

Defines an encoder that is used to encode Joint Photographics Experts Group (JPEG) format images. This class cannot be inherited.

Espacio de nombres: System.Windows.Media.Imaging
Ensamblado: PresentationCore (en presentationcore.dll)
Espacio de nombres XML:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public sealed class JpegBitmapEncoder : BitmapEncoder
public final class JpegBitmapEncoder extends BitmapEncoder
public final class JpegBitmapEncoder extends BitmapEncoder
<JpegBitmapEncoder .../>

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.

int width = 128;
int height = width;
int stride = width / 8;
byte[] pixels = new byte[height * stride];

// Define the image palette
BitmapPalette myPalette = BitmapPalettes.Halftone256;

// Creates a new empty image with the pre-defined palette
BitmapSource image = BitmapSource.Create(
    width,
    height,
    96,
    96,
    PixelFormats.Indexed1,
    myPalette,
    pixels,
    stride);

FileStream stream = new FileStream("new.jpg", FileMode.Create);
JpegBitmapEncoder encoder = new JpegBitmapEncoder();
TextBlock myTextBlock = 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);


Los miembros estáticos públicos (Shared en Visual Basic) de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.

.NET Framework

Compatible con: 3.0

Adiciones de comunidad

AGREGAR
Mostrar:
© 2014 Microsoft