Class JpegImage
Main class for work with JPEG images.
Inheritance
Implements
Inherited Members
Namespace: BitMiracle.LibJpeg
Assembly: BitMiracle.LibJpeg.NET.dll
Syntax
public sealed class JpegImage : IDisposable
Constructors
| Improve this Doc View SourceJpegImage(SampleRow[], Colorspace)
Creates JpegImage from pixels
Declaration
public JpegImage(SampleRow[] sampleData, Colorspace colorspace)
Parameters
| Type | Name | Description |
|---|---|---|
| SampleRow[] | sampleData | Description of pixels. |
| Colorspace | colorspace | Colorspace of image. |
See Also
| Improve this Doc View SourceJpegImage(Bitmap)
Creates JpegImage from System.Drawing.Bitmap
Declaration
public JpegImage(Bitmap bitmap)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Bitmap | bitmap | Source .NET bitmap. |
JpegImage(Stream)
Creates JpegImage from stream with an arbitrary image data
Declaration
public JpegImage(Stream imageData)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | imageData | Stream containing bytes of image in arbitrary format (BMP, Jpeg, GIF, PNG, TIFF, e.t.c) |
JpegImage(String)
Creates JpegImage from file with an arbitrary image
Declaration
public JpegImage(string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Path to file with image in arbitrary format (BMP, Jpeg, GIF, PNG, TIFF, e.t.c) |
Properties
| Improve this Doc View SourceBitsPerComponent
Gets the number of bits per color component of Sample.
Declaration
public byte BitsPerComponent { get; }
Property Value
| Type | Description |
|---|---|
| System.Byte | The number of bits per color component. |
Colorspace
Gets the colorspace of image.
Declaration
public Colorspace Colorspace { get; }
Property Value
| Type | Description |
|---|---|
| Colorspace | The colorspace of image. |
ComponentsPerSample
Gets the number of color components per Sample.
Declaration
public byte ComponentsPerSample { get; }
Property Value
| Type | Description |
|---|---|
| System.Byte | The number of color components per sample. |
Height
Gets the height of image in Sample.
Declaration
public int Height { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The height of image. |
Width
Gets the width of image in Sample.
Declaration
public int Width { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The width of image. |
Methods
| Improve this Doc View SourceDispose()
Frees and releases all resources allocated by this JpegImage
Declaration
public void Dispose()
FromBitmap(Bitmap)
Creates JpegImage from System.Drawing.Bitmap
Declaration
public static JpegImage FromBitmap(Bitmap bitmap)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Bitmap | bitmap | Source .NET bitmap. |
Returns
| Type | Description |
|---|---|
| JpegImage | Created instance of JpegImage class. |
Remarks
Same as corresponding JpegImage(Bitmap).
GetRow(Int32)
Retrieves the required row of image.
Declaration
public SampleRow GetRow(int rowNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | rowNumber | The number of row. |
Returns
| Type | Description |
|---|---|
| SampleRow | Image row of samples. |
ToBitmap()
Retrieves image as .NET Bitmap.
Declaration
public Bitmap ToBitmap()
Returns
| Type | Description |
|---|---|
| System.Drawing.Bitmap | .NET Bitmap |
WriteBitmap(Stream)
Writes decompressed image data as bitmap to stream.
Declaration
public void WriteBitmap(Stream output)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | output | Output stream. |
WriteJpeg(Stream)
Writes compressed JPEG image to stream.
Declaration
public void WriteJpeg(Stream output)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | output | Output stream. |
WriteJpeg(Stream, CompressionParameters)
Compresses image to JPEG with given parameters and writes it to stream.
Declaration
public void WriteJpeg(Stream output, CompressionParameters parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | output | Output stream. |
| CompressionParameters | parameters | The parameters of compression. |