Class PbmEncoder
Image encoder for writing an image to a stream as PGM, PBM or PPM bitmap. These images are from the family of PNM images.
The PNM formats are a fairly simple image format. They share a plain text header, consisting of: signature, width, height and max_pixel_value only. The pixels follow thereafter and can be in plain text decimals separated by spaces, or binary encoded.
- PBMBlack and white images, with 1 representing black and 0 representing white.
- PGMGrayscale images, scaling from 0 to max_pixel_value, 0 representing black and max_pixel_value representing white.
- PPMColor images, with RGB pixels (in that order), with 0 representing black and 2 representing full color.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp.Formats.Pbm
Assembly: SixLabors.ImageSharp.dll
Syntax
public sealed class PbmEncoder : ImageEncoder, IImageEncoder
Properties
| Edit this page View SourceColorType
Gets the Color type of the resulting image.
Declaration
public PbmColorType? ColorType { get; init; }
Property Value
Type | Description |
---|---|
PbmColorType? |
ComponentType
Gets the data type of the pixel components.
Declaration
public PbmComponentType? ComponentType { get; init; }
Property Value
Type | Description |
---|---|
PbmComponentType? |
Encoding
Gets the encoding of the pixels.
Declaration
public PbmEncoding? Encoding { get; init; }
Property Value
Type | Description |
---|---|
PbmEncoding? |
Methods
| Edit this page View SourceEncode<TPixel>(Image<TPixel>, Stream, CancellationToken)
Encodes the image to the specified stream from the Image<TPixel>.
Declaration
protected override void Encode<TPixel>(Image<TPixel> image, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>
Parameters
Type | Name | Description |
---|---|---|
Image<TPixel> | image | The Image<TPixel> to encode from. |
Stream | stream | The Stream to encode the image data to. |
CancellationToken | cancellationToken | The token to monitor for cancellation requests. |
Type Parameters
Name | Description |
---|---|
TPixel | The pixel format. |
Overrides
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.