Class ImageFile
Represents the base class for image files.
Namespace: ExifLibrary
Assembly: ExifLibrary.dll
Syntax
public abstract class ImageFile
Constructors
| Improve this Doc View SourceImageFile()
Initializes a new instance of the ImageFile class.
Declaration
protected ImageFile()
Properties
| Improve this Doc View SourceEncoding
Gets the encoding used for text metadata when the source encoding is unknown.
Declaration
public Encoding Encoding { get; protected set; }
Property Value
Type | Description |
---|---|
System.Text.Encoding |
Errors
Gets the errors encountered while reading/writing the image file.
Declaration
public List<ImageError> Errors { get; protected set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<ImageError> |
Format
Returns the format of the ImageFile.
Declaration
public ImageFileFormat Format { get; protected set; }
Property Value
Type | Description |
---|---|
ImageFileFormat |
Item[Int32]
Gets or sets the Exif property with the given key.
Declaration
public ExifProperty this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type | Description |
---|---|
ExifProperty |
Properties
Gets the collection of Exif properties contained in the ImageFile.
Declaration
public ExifPropertyCollection<ExifProperty> Properties { get; }
Property Value
Type | Description |
---|---|
ExifPropertyCollection<ExifProperty> |
Thumbnail
Gets or sets the embedded thumbnail image.
Declaration
public byte[] Thumbnail { get; set; }
Property Value
Type | Description |
---|---|
System.Byte[] |
Methods
| Improve this Doc View SourceCrush()
Decreases file size by removing all metadata.
Declaration
public abstract void Crush()
FromBuffer(Byte[])
Creates an ImageFile from the specified data.
Declaration
public static ImageFile FromBuffer(byte[] imageData)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | imageData | A buffer containing image data. |
Returns
Type | Description |
---|---|
ImageFile | The ImageFile created from the buffer. |
FromBuffer(Byte[], Encoding)
Creates an ImageFile from the specified data.
Declaration
protected static ImageFile FromBuffer(byte[] imageData, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | imageData | A buffer containing image data. |
System.Text.Encoding | encoding | The encoding to be used for text metadata when the source encoding is unknown. |
Returns
Type | Description |
---|---|
ImageFile | The ImageFile created from the buffer. |
FromFile(String)
Creates an ImageFile from the specified file.
Declaration
public static ImageFile FromFile(string filename)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | A string that contains the name of the file. |
Returns
Type | Description |
---|---|
ImageFile | The ImageFile created from the file. |
FromFile(String, Encoding)
Creates an ImageFile from the specified file.
Declaration
public static ImageFile FromFile(string filename, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | A string that contains the name of the file. |
System.Text.Encoding | encoding | The encoding to be used for text metadata when the source encoding is unknown. |
Returns
Type | Description |
---|---|
ImageFile | The ImageFile created from the file. |
FromFileAsync(String)
Creates an ImageFile from the specified file by asynchronously reading image data.
Declaration
public static Task<ImageFile> FromFileAsync(string filename)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | A string that contains the name of the file. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ImageFile> | The ImageFile created from the file. |
FromFileAsync(String, Encoding)
Creates an ImageFile from the specified file while while asynchronously reading image data.
Declaration
public static Task<ImageFile> FromFileAsync(string filename, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | A string that contains the name of the file. |
System.Text.Encoding | encoding | The encoding to be used for text metadata when the source encoding is unknown. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ImageFile> | The ImageFile created from the file. |
FromStream(Stream)
Creates an ImageFile from the specified data stream.
Declaration
public static ImageFile FromStream(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | A stream that contains image data. |
Returns
Type | Description |
---|---|
ImageFile | The ImageFile created from the stream. |
FromStream(Stream, Encoding)
Creates an ImageFile from the specified data stream.
Declaration
protected static ImageFile FromStream(Stream stream, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | A stream that contains image data. |
System.Text.Encoding | encoding | The encoding to be used for text metadata when the source encoding is unknown. |
Returns
Type | Description |
---|---|
ImageFile | The ImageFile created from the stream. |
FromStreamAsync(Stream)
Creates an ImageFile from the specified data stream by asynchronously reading image data.
Declaration
public static Task<ImageFile> FromStreamAsync(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | A stream that contains image data. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ImageFile> | The ImageFile created from the stream. |
FromStreamAsync(Stream, Encoding)
Creates an ImageFile from the specified data stream by asynchronously reading image data.
Declaration
public static Task<ImageFile> FromStreamAsync(Stream stream, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | A stream that contains image data. |
System.Text.Encoding | encoding | The encoding to be used for text metadata when the source encoding is unknown. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ImageFile> | The ImageFile created from the stream. |
FromStreamInternal(MemoryStream, Encoding)
Creates an ImageFile from the specified data stream.
Declaration
protected static ImageFile FromStreamInternal(MemoryStream stream, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.IO.MemoryStream | stream | A stream that contains image data. |
System.Text.Encoding | encoding | The encoding to be used for text metadata when the source encoding is unknown. |
Returns
Type | Description |
---|---|
ImageFile | The ImageFile created from the file. |
Save(Stream)
Asynchronously saves the ImageFile to the specified stream.
Declaration
public void Save(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | A stream to save image data to. |
Save(String)
Saves the ImageFile to the specified file.
Declaration
public virtual void Save(string filename)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | A string that contains the name of the file. |
SaveAsync(Stream)
Asynchronously saves the ImageFile to the specified stream.
Declaration
public virtual Task SaveAsync(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | A stream to save image data to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
SaveAsync(String)
Asynchronously saves the ImageFile to the specified file.
Declaration
public virtual Task SaveAsync(string filename)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | A string that contains the name of the file. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
SaveInternal(MemoryStream)
Saves the ImageFile to the specified stream.
Declaration
protected abstract void SaveInternal(MemoryStream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.MemoryStream | stream | A stream to save image data to. |