XImage
Inheritance: java.lang.Object
public final class XImage
Class representing image X-Object.
Constructors
Constructor | Description |
---|---|
XImage(IPdfDataStream image) | for internal usage only |
Methods
Method | Description |
---|---|
containsTransparency() | If the image contains transparancy than return true; otherwise, false. |
getFilterType() | Gets image filter type. |
getGrayscaled() | Gets grayscaled version of image. |
delete() | Deletes image from the parent collection. |
replace(InputStream image) | Replaces image onto stream specified in image . |
getEngineImg() | IPdfImage object which decribes image. |
getWidth() | Gets width of the image. |
getHeight() | Gets height of the image. |
getName() | Gets image name. |
setName(String value) | Sets image name. |
rename(String name) | Renames image and replaces all references to the image with the new name |
save(OutputStream stream) | Saves image data into stream as JPEG image. |
save(OutputStream stream, float xDpi, float yDpi) | Saves image into stream with requested format. |
saveInternal(System.IO.Stream stream, ImageType format) | Saves image into stream with requested format. |
save(OutputStream stream, ImageType format) | Saves image into stream with requested format. |
getImage() | For internal use only |
saveInternal(System.IO.Stream stream, int resolution) | Saves image data into stream as JPEG image with specified resolution. |
save(OutputStream stream, int resolution) | Saves image into stream with requested format with specified resolution. |
saveInternal(System.IO.Stream stream, ImageType format, int resolution) | |
save(OutputStream stream, ImageType format, int resolution) | Saves image into stream with requested format. |
isImage(IPdfPrimitive primitive) | Returns true if the primitive is an image. |
getColorType() | Returns color type of image. |
detectColorType(BufferedImage bmp) | Returns color type of image. |
isTheSameObject(XImage image) | Returns true if both images references to the same object. |
getNameInCollection() | Returns name of the image in its collection. |
getRawParameters() | Gets raw image parameters |
toString() | Returns a string representation XImage object properties. |
getRawBytes() | Returns raw bytes for the image without decoding. |
toStream() | Returns the original image stream. |
getMetadata() | Metadata of the image. |
XImage(IPdfDataStream image)
public XImage(IPdfDataStream image)
for internal usage only
Parameters:
Parameter | Type | Description |
---|---|---|
image | IPdfDataStream | internal instance |
containsTransparency()
public boolean containsTransparency()
If the image contains transparancy than return true; otherwise, false.
Returns: boolean - boolean value
getFilterType()
public final int getFilterType()
Gets image filter type.
Returns: int - ImageFilterType element
getGrayscaled()
public BufferedImage getGrayscaled()
Gets grayscaled version of image.
Returns: java.awt.image.BufferedImage - BufferedImage
delete()
public void delete()
Deletes image from the parent collection.
replace(InputStream image)
public void replace(InputStream image)
Replaces image onto stream specified in image .
*
Parameters:
Parameter | Type | Description |
---|---|---|
image | java.io.InputStream | Stream with image data. |
getEngineImg()
public IPdfDataStream getEngineImg()
IPdfImage object which decribes image. Internal only
Returns: IPdfDataStream - IPdfDataStream
getWidth()
public int getWidth()
Gets width of the image.
Returns: int - int value
getHeight()
public int getHeight()
Gets height of the image.
Returns: int - int value
getName()
public String getName()
Gets image name. Please note that if you change name of the image which has references in page contents, document may became incorrect. Please use XImage.Rename method in this case.
Returns: java.lang.String - String
setName(String value)
public void setName(String value)
Sets image name. Please note that if you change name of the image which has references in page contents, document may became incorrect. Please use XImage.Rename method in this case.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String | String value |
rename(String name)
public final void rename(String name)
Renames image and replaces all references to the image with the new name
Parameters:
Parameter | Type | Description |
---|---|---|
name | java.lang.String | New image name. |
save(OutputStream stream)
public void save(OutputStream stream)
Saves image data into stream as JPEG image.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | Stream where image data will be saved. |
save(OutputStream stream, float xDpi, float yDpi)
public void save(OutputStream stream, float xDpi, float yDpi)
Saves image into stream with requested format.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | OutputStream where image will be saved |
xDpi | float | Image horizontal resolution |
yDpi | float | Image vertical resolution |
saveInternal(System.IO.Stream stream, ImageType format)
public void saveInternal(System.IO.Stream stream, ImageType format)
Saves image into stream with requested format.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | com.aspose.ms.System.IO.Stream | Stream where image will be saved |
format | ImageType | Format which will be used for image enconding. ImageFormat |
save(OutputStream stream, ImageType format)
public void save(OutputStream stream, ImageType format)
Saves image into stream with requested format.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | Stream where image will be saved |
format | ImageType | Format which will be used for image enconding. |
getImage()
public System.Drawing.Bitmap getImage()
For internal use only
Returns: com.aspose.ms.System.Drawing.Bitmap - Image
saveInternal(System.IO.Stream stream, int resolution)
public void saveInternal(System.IO.Stream stream, int resolution)
Saves image data into stream as JPEG image with specified resolution.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | com.aspose.ms.System.IO.Stream | Stream where image data will be saved. |
resolution | int | Image resolution |
save(OutputStream stream, int resolution)
public void save(OutputStream stream, int resolution)
Saves image into stream with requested format with specified resolution.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | Stream where image will be saved |
resolution | int | Image resolution |
saveInternal(System.IO.Stream stream, ImageType format, int resolution)
public void saveInternal(System.IO.Stream stream, ImageType format, int resolution)
Parameters:
Parameter | Type | Description |
---|---|---|
stream | com.aspose.ms.System.IO.Stream | |
format | ImageType | |
resolution | int |
save(OutputStream stream, ImageType format, int resolution)
public void save(OutputStream stream, ImageType format, int resolution)
Saves image into stream with requested format.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | Stream where image will be saved |
format | ImageType | Format which will be used for image enconding. |
resolution | int | Image resolution |
isImage(IPdfPrimitive primitive)
public static boolean isImage(IPdfPrimitive primitive)
Returns true if the primitive is an image.
Parameters:
Parameter | Type | Description |
---|---|---|
primitive | IPdfPrimitive | IPdfPrimitive |
Returns: boolean - boolean
getColorType()
public int getColorType()
Returns color type of image.
Returns: int - The color type value.
detectColorType(BufferedImage bmp)
public static int detectColorType(BufferedImage bmp)
Returns color type of image.
Parameters:
Parameter | Type | Description |
---|---|---|
bmp | java.awt.image.BufferedImage | Image. |
Returns: int - Color type.
isTheSameObject(XImage image)
public boolean isTheSameObject(XImage image)
Returns true if both images references to the same object.
Parameters:
Parameter | Type | Description |
---|---|---|
image | XImage | Image to be compared with “this” image. |
Returns: boolean - Boolean value which is true if images references to the same object.
getNameInCollection()
public String getNameInCollection()
Returns name of the image in its collection.
Returns: java.lang.String - Image key (name).
getRawParameters()
public XImage.RawParameters getRawParameters()
Gets raw image parameters
Returns: RawParameters - RawParameters instance
toString()
public String toString()
Returns a string representation XImage object properties.
Returns: java.lang.String - String instance
getRawBytes()
public byte[] getRawBytes()
Returns raw bytes for the image without decoding.
Returns: byte[] - byte array
toStream()
public InputStream toStream()
Returns the original image stream.
Returns: java.io.InputStream - The original image stream.
getMetadata()
public final Metadata getMetadata()
Metadata of the image.
Returns: Metadata - Metadata instance