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

ConstructorDescription
Image()Initializes a new instance of the Image class.

Methods

MethodDescription
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:

ParameterTypeDescription
valueColorPalette

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:

ParameterTypeDescription
valuejava.lang.Object

fromFile(String filename)

public static Image fromFile(String filename)

Creates an Image from the specified file.

Parameters:

ParameterTypeDescription
filenamejava.lang.StringA 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:

ParameterTypeDescription
streamjava.io.InputStreamA 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:

ParameterTypeDescription
streamjava.io.InputStreamA java.io.InputStream that contains the data for this Image.
useEmbeddedColorManagementbooleantrue 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:

ParameterTypeDescription
hbitmapbyte[]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:

ParameterTypeDescription
pixfmtintThe 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:

ParameterTypeDescription
pixfmtintThe 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:

ParameterTypeDescription
thumbWidthintThe width, in pixels, of the requested thumbnail image.
thumbHeightintThe height, in pixels, of the requested thumbnail image.
callbackGetThumbnailImageAbortA GetThumbnailImageAbort delegate. NoteYou must create a delegate and pass a reference to the delegate as the callback parameter, but the delegate is not used.
callbackDatabyte[]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:

ParameterTypeDescription
pageUnitint[]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:

ParameterTypeDescription
dimensionFrameDimensionA 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:

ParameterTypeDescription
filenamejava.lang.StringA 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:

ParameterTypeDescription
filenamejava.lang.StringA string that contains the name of the file to which to save this Image.
formatintThe 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:

ParameterTypeDescription
filenamejava.lang.StringA string that contains the name of the file to which to save this Image.
encoderImageCodecInfoThe ImageCodecInfo for this Image.
encoderParamsEncoderParametersAn 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:

ParameterTypeDescription
streamjava.io.OutputStreamThe java.io.InputStream where the image will be saved.
formatintAn 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:

ParameterTypeDescription
streamjava.io.OutputStreamThe java.io.InputStream where the image will be saved.
encoderImageCodecInfoThe ImageCodecInfo for this Image.
encoderParamsEncoderParametersAn 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:

ParameterTypeDescription
encoderParamsEncoderParametersAn 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:

ParameterTypeDescription
imageImageAn Image that contains the frame to add.
encoderParamsEncoderParametersAn 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:

ParameterTypeDescription
rotateFlipTypeintA 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:

ParameterTypeDescription
dimensionFrameDimensionA FrameDimension that specifies the identity of the dimension type.
frameIndexintThe 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:

ParameterTypeDescription
propidintThe 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:

ParameterTypeDescription
propidintThe 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:

ParameterTypeDescription
propitemPropertyItemThe PropertyItem to be stored.