public abstract class ImageFormat extends FormatBase
Represents base abstraction for image format.
Modifier | Constructor and Description |
---|---|
protected |
ImageFormat(InputStream input)
Initializes a new instance of the
ImageFormat class. |
protected |
ImageFormat(InputStream input,
com.aspose.ms.System.Text.Encoding encoding)
Initializes a new instance of the
ImageFormat class. |
protected |
ImageFormat(String fileName)
Initializes a new instance of the
ImageFormat class. |
protected |
ImageFormat(String fileName,
com.aspose.ms.System.Text.Encoding encoding)
Initializes a new instance of the
ImageFormat class. |
Modifier and Type | Method and Description |
---|---|
void |
cleanMetadata()
Removes all metadata presented in image.
|
static ImageFormat |
fromFile(String fileName)
Creates
ImageFormat from the existing file. |
static ImageFormat |
fromFile(String fileName,
Charset encoding)
Creates
ImageFormat from the existing file. |
static ImageFormat |
fromStream(InputStream stream)
Creates
ImageFormat from the System.IO.Stream . |
int |
getByteOrder()
Gets the byte-order.
|
int |
getHeight()
Gets the image height.
|
int |
getWidth()
Gets the image width.
|
close, dispose, dispose, getMetadata, getMIMEType, getType, readByMetadataKey, save, save, save
protected ImageFormat(String fileName)
Initializes a new instance of the ImageFormat
class.
fileName
- Absolute path to the file.protected ImageFormat(String fileName, com.aspose.ms.System.Text.Encoding encoding)
Initializes a new instance of the ImageFormat
class.
fileName
- Absolute path to the file.encoding
- Image encoding.protected ImageFormat(InputStream input)
Initializes a new instance of the ImageFormat
class.
input
- File stream.protected ImageFormat(InputStream input, com.aspose.ms.System.Text.Encoding encoding)
Initializes a new instance of the ImageFormat
class.
input
- File stream.encoding
- Image encoding.public int getWidth()
Gets the image width.
public int getHeight()
Gets the image height.
public final int getByteOrder()
Gets the byte-order. See https://en.wikipedia.org/wiki/Endianness".
public static ImageFormat fromFile(String fileName)
Creates ImageFormat
from the existing file.
fileName
- Absolute path to the file.ImageFormat
if fileName
has image format; otherwise throws InvalidFormatException
.ArgumentNullException
- Path could not be null or empty.com.aspose.ms.System.IO.FileNotFoundException
- File does not exist.public static ImageFormat fromFile(String fileName, Charset encoding)
Creates ImageFormat
from the existing file.
fileName
- Absolute path to the file.encoding
- The encoding using for text metadata for unknown encoding.ImageFormat
if fileName
has image format; otherwise throws InvalidFormatException
.public static ImageFormat fromStream(InputStream stream)
Creates ImageFormat
from the System.IO.Stream
.
stream
- Input stream.ImageFormat
if stream
is an image; otherwise throws InvalidFormatException
.ArgumentNullException
- Stream could not be null.public void cleanMetadata()
Removes all metadata presented in image.
cleanMetadata
in class FormatBase
Copyright © 2019. All rights reserved.