Image
Inheritance: java.lang.Object
All Implemented Interfaces: com.aspose.ms.System.IDisposable
public abstract class Image implements System.IDisposable
An abstract base class that provides functionality for the Bitmap and Metafile descended classes.
Constructors
Constructor | Description |
---|---|
Image() | Initializes a new instance of the Image class. |
Methods
Method | Description |
---|---|
getWidth() | Gets the width, in pixels, of this Image. |
getHeight() | Gets the height, in pixels, of this Image. |
getSize() | Gets the width and height, in pixels, of this image. |
getHorizontalResolution() | Gets the horizontal resolution, in pixels per inch, of this Image. |
getVerticalResolution() | Gets the vertical resolution, in pixels per inch, of this Image. |
getRawFormat() | Gets the file format of this Image. |
getPixelFormat() | Gets the pixel format for this Image. |
getPalette() | Gets or sets the color palette used for this Image. |
setPalette(ColorPalette value) | Gets or sets the color palette used for this Image. |
getPhysicalDimension() | Gets the width and height of this image. |
getFrameDimensionsList() | Gets an array of GUIDs that represent the dimensions of frames within this Image. |
getFlags() | Gets the integer representing a bitwise combination of ImageFlags for this Image. |
getPropertyIdList() | Gets IDs of the property items stored in this Image. |
getPropertyItems() | Gets all the property items (pieces of metadata) stored in this Image. |
getTag() | Gets or sets an object that provides additional data about the image. |
setTag(Object value) | Gets or sets an object that provides additional data about the image. |
fromFile(String filename) | Creates an Image from the specified file. |
fromStream(InputStream stream) | Creates an Image from the specified data stream. |
fromStream(InputStream stream, boolean useEmbeddedColorManagement) | Creates an Image from the specified data stream, optionally using embedded color management information in that stream. |
fromHbitmap(byte[] hbitmap) | Creates a Bitmap from a handle to a GDI bitmap. |
getPixelFormatSize(int pixfmt) | Returns the color depth, in number of bits per pixel, of the specified pixel format. |
isAlphaPixelFormat(int pixfmt) | Returns a value that indicates whether the pixel format for this Image contains alpha information. |
getThumbnailImage(int thumbWidth, int thumbHeight, Image.GetThumbnailImageAbort callback, byte[] callbackData) | Returns a thumbnail for this Image. |
dispose() | Releases all resources used by this Image. |
deepClone() | Creates an exact copy of this Image. |
getBounds(int[] pageUnit) | Gets the bounds of the image in the specified unit. |
getFrameCount(FrameDimension dimension) | Returns the number of frames of the specified dimension. |
save(String filename) | Saves this Image to the specified file or stream. |
save(String filename, int format) | Saves this Image to the specified file in the specified format. |
save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) | Saves this Image to the specified file, with the specified encoder and image-encoder parameters. |
save(OutputStream stream, int format) | Saves this image to the specified stream in the specified format. |
save(OutputStream stream, ImageCodecInfo encoder, EncoderParameters encoderParams) | Saves this image to the specified stream, with the specified encoder and image encoder parameters. |
saveAdd(EncoderParameters encoderParams) | Adds a frame to the file or stream specified in a previous call to the one of Image.Save(…) methods. |
saveAdd(Image image, EncoderParameters encoderParams) | Adds a frame to the file or stream specified in a previous call to the one of Image.Save(…) methods. |
rotateFlip(int rotateFlipType) | This method rotates, flips, or rotates and flips the Image. |
selectActiveFrame(FrameDimension dimension, int frameIndex) | Selects the frame specified by the dimension and index. |
getPropertyItem(int propid) | Gets the specified property item from this Image. |
removePropertyItem(int propid) | Removes the specified property item from this Image. |
setPropertyItem(PropertyItem propitem) | Stores a property item (piece of metadata) in this Image. |
Image()
public Image()
Initializes a new instance of the Image class.
getWidth()
public abstract int getWidth()
Gets the width, in pixels, of this Image.
Returns: int
getHeight()
public abstract int getHeight()
Gets the height, in pixels, of this Image.
Returns: int
getSize()
public final Size getSize()
Gets the width and height, in pixels, of this image.
Returns:
Size - A Size
(.getSize) structure that represents the width and height, in pixels, of this image.
getHorizontalResolution()
public final float getHorizontalResolution()
Gets the horizontal resolution, in pixels per inch, of this Image.
Returns: float
getVerticalResolution()
public final float getVerticalResolution()
Gets the vertical resolution, in pixels per inch, of this Image.
Returns: float
getRawFormat()
public abstract ImageFormat getRawFormat()
Gets the file format of this Image.
Returns: ImageFormat - The ImageFormat that represents the file format of this Image.
getPixelFormat()
public abstract int getPixelFormat()
Gets the pixel format for this Image.
Returns:
int - A PixelFormat
(.getPixelFormat) that represents the pixel format for this Image.
getPalette()
public abstract ColorPalette getPalette()
Gets or sets the color palette used for this Image.
Returns: ColorPalette - A ColorPalette that represents the color palette used for this Image.
setPalette(ColorPalette value)
public abstract void setPalette(ColorPalette value)
Gets or sets the color palette used for this Image.
Parameters:
Parameter | Type | Description |
---|---|---|
value | ColorPalette |
getPhysicalDimension()
public final SizeF getPhysicalDimension()
Gets the width and height of this image.
Returns: SizeF - A SizeF structure that represents the width and height of this Image.
getFrameDimensionsList()
public UUID[] getFrameDimensionsList()
Gets an array of GUIDs that represent the dimensions of frames within this Image.
Returns: java.util.UUID[] - An array of GUIDs that specify the dimensions of frames within this Image from most significant to least significant.
getFlags()
public final int getFlags()
Gets the integer representing a bitwise combination of ImageFlags for this Image.
Returns: int
getPropertyIdList()
public abstract int[] getPropertyIdList()
Gets IDs of the property items stored in this Image.
Returns: int[] - An array of the property IDs, one for each property item stored in this image.
getPropertyItems()
public abstract PropertyItem[] getPropertyItems()
Gets all the property items (pieces of metadata) stored in this Image.
Returns: com.aspose.drawing.imaging.PropertyItem[] - An array of PropertyItem objects, one for each property item stored in the image.
getTag()
public final Object getTag()
Gets or sets an object that provides additional data about the image.
Returns: java.lang.Object
setTag(Object value)
public final void setTag(Object value)
Gets or sets an object that provides additional data about the image.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.Object |
fromFile(String filename)
public static Image fromFile(String filename)
Creates an Image from the specified file.
Parameters:
Parameter | Type | Description |
---|---|---|
filename | java.lang.String | A string that contains the name of the file from which to create the Image. |
Returns: Image - The Image this method creates.
fromStream(InputStream stream)
public static Image fromStream(InputStream stream)
Creates an Image from the specified data stream.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | A java.io.InputStream that contains the data for this Image. |
Returns: Image - The Image this method creates.
fromStream(InputStream stream, boolean useEmbeddedColorManagement)
public static Image fromStream(InputStream stream, boolean useEmbeddedColorManagement)
Creates an Image from the specified data stream, optionally using embedded color management information in that stream.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | A java.io.InputStream that contains the data for this Image. |
useEmbeddedColorManagement | boolean | true to use color management information embedded in the data stream; otherwise, false. |
Returns: Image - The Image this method creates.
fromHbitmap(byte[] hbitmap)
public static Bitmap fromHbitmap(byte[] hbitmap)
Creates a Bitmap from a handle to a GDI bitmap.
Parameters:
Parameter | Type | Description |
---|---|---|
hbitmap | byte[] | The GDI bitmap handle from which to create the Bitmap. |
Returns: Bitmap - The Bitmap this method creates.
getPixelFormatSize(int pixfmt)
public static int getPixelFormatSize(int pixfmt)
Returns the color depth, in number of bits per pixel, of the specified pixel format.
Parameters:
Parameter | Type | Description |
---|---|---|
pixfmt | int | The PixelFormat (.getPixelFormat) member that specifies the format for which to find the size. |
Returns: int - The color depth of the specified pixel format.
isAlphaPixelFormat(int pixfmt)
public static boolean isAlphaPixelFormat(int pixfmt)
Returns a value that indicates whether the pixel format for this Image contains alpha information.
Parameters:
Parameter | Type | Description |
---|---|---|
pixfmt | int | The PixelFormat (.getPixelFormat) to test. |
Returns:
boolean - true if pixfmt
contains alpha information; otherwise, false.
getThumbnailImage(int thumbWidth, int thumbHeight, Image.GetThumbnailImageAbort callback, byte[] callbackData)
public final Image getThumbnailImage(int thumbWidth, int thumbHeight, Image.GetThumbnailImageAbort callback, byte[] callbackData)
Returns a thumbnail for this Image.
Parameters:
Parameter | Type | Description |
---|---|---|
thumbWidth | int | The width, in pixels, of the requested thumbnail image. |
thumbHeight | int | The height, in pixels, of the requested thumbnail image. |
callback | GetThumbnailImageAbort | A GetThumbnailImageAbort delegate. NoteYou must create a delegate and pass a reference to the delegate as the callback parameter, but the delegate is not used. |
callbackData | byte[] | Must be IntPtr.Zero . |
Returns: Image - An Image that represents the thumbnail.
dispose()
public void dispose()
Releases all resources used by this Image.
This method actually does nothing. It’s just for compatibility with System.Drawing API.
deepClone()
public final Object deepClone()
Creates an exact copy of this Image.
Returns: java.lang.Object - The Image this method creates, cast as an object.
getBounds(int[] pageUnit)
public final RectangleF getBounds(int[] pageUnit)
Gets the bounds of the image in the specified unit.
Parameters:
Parameter | Type | Description |
---|---|---|
pageUnit | int[] | One of the GraphicsUnit values indicating the unit of measure for the bounding rectangle. |
Returns: RectangleF - The RectangleF that represents the bounds of the image, in the specified unit.
getFrameCount(FrameDimension dimension)
public final int getFrameCount(FrameDimension dimension)
Returns the number of frames of the specified dimension.
Parameters:
Parameter | Type | Description |
---|---|---|
dimension | FrameDimension | A FrameDimension that specifies the identity of the dimension type. |
Returns: int - The number of frames in the specified dimension.
save(String filename)
public final void save(String filename)
Saves this Image to the specified file or stream.
Parameters:
Parameter | Type | Description |
---|---|---|
filename | java.lang.String | A string that contains the name of the file to which to save this Image. |
save(String filename, int format)
public final void save(String filename, int format)
Saves this Image to the specified file in the specified format.
Parameters:
Parameter | Type | Description |
---|---|---|
filename | java.lang.String | A string that contains the name of the file to which to save this Image. |
format | int | The ImageFormat for this Image. |
save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
public final void save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
Saves this Image to the specified file, with the specified encoder and image-encoder parameters.
Parameters:
Parameter | Type | Description |
---|---|---|
filename | java.lang.String | A string that contains the name of the file to which to save this Image. |
encoder | ImageCodecInfo | The ImageCodecInfo for this Image. |
encoderParams | EncoderParameters | An EncoderParameters to use for this Image. |
save(OutputStream stream, int format)
public final void save(OutputStream stream, int format)
Saves this image to the specified stream in the specified format.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | The java.io.InputStream where the image will be saved. |
format | int | An ImageFormat that specifies the format of the saved image. |
save(OutputStream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
public final void save(OutputStream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
Saves this image to the specified stream, with the specified encoder and image encoder parameters.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | The java.io.InputStream where the image will be saved. |
encoder | ImageCodecInfo | The ImageCodecInfo for this Image. |
encoderParams | EncoderParameters | An EncoderParameters that specifies parameters used by the image encoder. |
saveAdd(EncoderParameters encoderParams)
public final void saveAdd(EncoderParameters encoderParams)
Adds a frame to the file or stream specified in a previous call to the one of Image.Save(…) methods. Use this method to save selected frames from a multiple-frame image to another multiple-frame image.
Parameters:
Parameter | Type | Description |
---|---|---|
encoderParams | EncoderParameters | An EncoderParameters that holds parameters required by the image encoder that is used by the save-add operation. |
saveAdd(Image image, EncoderParameters encoderParams)
public final void saveAdd(Image image, EncoderParameters encoderParams)
Adds a frame to the file or stream specified in a previous call to the one of Image.Save(…) methods.
Parameters:
Parameter | Type | Description |
---|---|---|
image | Image | An Image that contains the frame to add. |
encoderParams | EncoderParameters | An EncoderParameters that holds parameters required by the image encoder that is used by the save-add operation. |
rotateFlip(int rotateFlipType)
public abstract void rotateFlip(int rotateFlipType)
This method rotates, flips, or rotates and flips the Image.
Parameters:
Parameter | Type | Description |
---|---|---|
rotateFlipType | int | A RotateFlipType member that specifies the type of rotation and flip to apply to the image. |
selectActiveFrame(FrameDimension dimension, int frameIndex)
public final int selectActiveFrame(FrameDimension dimension, int frameIndex)
Selects the frame specified by the dimension and index.
Parameters:
Parameter | Type | Description |
---|---|---|
dimension | FrameDimension | A FrameDimension that specifies the identity of the dimension type. |
frameIndex | int | The index of the active frame. |
Returns: int - Always returns 0.
getPropertyItem(int propid)
public abstract PropertyItem getPropertyItem(int propid)
Gets the specified property item from this Image.
Parameters:
Parameter | Type | Description |
---|---|---|
propid | int | The ID of the property item to get. |
Returns: PropertyItem - The PropertyItem this method gets.
removePropertyItem(int propid)
public abstract void removePropertyItem(int propid)
Removes the specified property item from this Image.
Parameters:
Parameter | Type | Description |
---|---|---|
propid | int | The ID of the property item to remove. |
setPropertyItem(PropertyItem propitem)
public abstract void setPropertyItem(PropertyItem propitem)
Stores a property item (piece of metadata) in this Image.
Parameters:
Parameter | Type | Description |
---|---|---|
propitem | PropertyItem | The PropertyItem to be stored. |