|
ASPOSE home |
java.lang.Objectcom.aspose.words.ImageData
public class ImageData
Use the An image can be stored inside a shape, linked to external file or both (linked and stored in the document). Regardless of whether the image is stored inside the shape or linked, you can always access the actual
image using the To store an image inside a shape use the
Property Getters/Setters Summary | ||
---|---|---|
boolean | getBiLevel() | |
void | setBiLevel(boolean value) | |
Determines whether an image will be displayed in black and white. | ||
Borders | getBorders() | |
Gets the collection of borders of the image. Borders only have effect for inline images. | ||
double | getBrightness() | |
void | setBrightness(double value) | |
Gets or sets the brightness of the picture. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). | ||
java.awt.Color | getChromaKey() | |
void | setChromaKey(java.awt.Color value) | |
Defines the color value of the image that will be treated as transparent. | ||
double | getContrast() | |
void | setContrast(double value) | |
Gets or sets the contrast for the specified picture. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). | ||
double | getCropBottom() | |
void | setCropBottom(double value) | |
Defines the fraction of picture removal from the bottom side. | ||
double | getCropLeft() | |
void | setCropLeft(double value) | |
Defines the fraction of picture removal from the left side. | ||
double | getCropRight() | |
void | setCropRight(double value) | |
Defines the fraction of picture removal from the right side. | ||
double | getCropTop() | |
void | setCropTop(double value) | |
Defines the fraction of picture removal from the top side. | ||
boolean | getGrayScale() | |
void | setGrayScale(boolean value) | |
Determines whether a picture will display in grayscale mode. | ||
boolean | hasImage() | |
Returns true if the shape has image bytes or links an image. | ||
byte[] | getImageBytes() | |
Gets the raw bytes of the image stored in the shape. | ||
ImageSize | getImageSize() | |
Gets the information about image size and resolution. | ||
int | getImageType() | |
Gets the type of the image. The value of the property is ImageType integer constant. | ||
boolean | isLink() | |
Returns true if the image is linked to the shape (when |
||
boolean | isLinkOnly() | |
Returns true if the image is linked and not stored in the document. | ||
java.lang.String | getSourceFullName() | |
void | setSourceFullName(java.lang.String value) | |
Gets or sets the path and name of the source file for the linked image. | ||
java.lang.String | getTitle() | |
void | setTitle(java.lang.String value) | |
Defines the title of an image. |
Method Summary | ||
---|---|---|
java.lang.Object | fetchInheritedAttr(int key) | |
Reserved for internal use. | ||
java.lang.Object | getDirectAttr(int key) | |
Reserved for internal use. | ||
void | save(java.io.OutputStream stream) | |
Saves the image into the specified stream. | ||
void | save(java.lang.String fileName) | |
Saves the image into a file. | ||
void | setAttr(int key, java.lang.Object value) | |
Reserved for internal use. | ||
void | setImage(byte[] imageBytes) | |
Sets the image that the shape displays. | ||
void | setImage(java.awt.image.BufferedImage image) | |
Sets the image that the shape displays. | ||
void | setImage(java.io.InputStream stream) | |
Sets the image that the shape displays. | ||
void | setImage(java.lang.String fileName) | |
Sets the image that the shape displays. | ||
java.awt.image.BufferedImage | toImage() | |
Gets the image stored in the shape as a java BufferedImage object. | ||
java.io.InputStream | toInputStream() | |
Creates and returns a stream that contains the image bytes. |
Property Getters/Setters Detail |
---|
getImageBytes | |
public byte[] getImageBytes() |
Returns null
if the image is not stored in the document.
hasImage | |
public boolean hasImage() |
getImageSize | |
public ImageSize getImageSize() |
If the image is linked only and not stored in the document, returns zero size.
getImageType | |
public int getImageType() |
getSourceFullName/setSourceFullName | |
public java.lang.String getSourceFullName() public void setSourceFullName(java.lang.String value) |
The default value is an empty string.
If
If null
,
then the image is linked and not stored in the document.
isLink | |
public boolean isLink() |
isLinkOnly | |
public boolean isLinkOnly() |
getTitle/setTitle | |
public java.lang.String getTitle() public void setTitle(java.lang.String value) |
The default value is an empty string.
getCropTop/setCropTop | |
public double getCropTop() public void setCropTop(double value) |
The amount of cropping can range from -1.0 to 1.0. The default value is 0. Note that a value of 1 will display no picture at all. Negative values will result in the picture being squeezed inward from the edge being cropped (the empty space between the picture and the cropped edge will be filled by the fill color of the shape). Positive values less than 1 will result in the remaining picture being stretched to fit the shape.
The default value is 0.
getCropBottom/setCropBottom | |
public double getCropBottom() public void setCropBottom(double value) |
The amount of cropping can range from -1.0 to 1.0. The default value is 0. Note that a value of 1 will display no picture at all. Negative values will result in the picture being squeezed inward from the edge being cropped (the empty space between the picture and the cropped edge will be filled by the fill color of the shape). Positive values less than 1 will result in the remaining picture being stretched to fit the shape.
The default value is 0.
getCropLeft/setCropLeft | |
public double getCropLeft() public void setCropLeft(double value) |
The amount of cropping can range from -1.0 to 1.0. The default value is 0. Note that a value of 1 will display no picture at all. Negative values will result in the picture being squeezed inward from the edge being cropped (the empty space between the picture and the cropped edge will be filled by the fill color of the shape). Positive values less than 1 will result in the remaining picture being stretched to fit the shape.
The default value is 0.
getCropRight/setCropRight | |
public double getCropRight() public void setCropRight(double value) |
The amount of cropping can range from -1.0 to 1.0. The default value is 0. Note that a value of 1 will display no picture at all. Negative values will result in the picture being squeezed inward from the edge being cropped (the empty space between the picture and the cropped edge will be filled by the fill color of the shape). Positive values less than 1 will result in the remaining picture being stretched to fit the shape.
The default value is 0.
getBorders | |
public Borders getBorders() |
getChromaKey/setChromaKey | |
public java.awt.Color getChromaKey() public void setChromaKey(java.awt.Color value) |
The default value is 0.
getBrightness/setBrightness | |
public double getBrightness() public void setBrightness(double value) |
The default value is 0.5.
getContrast/setContrast | |
public double getContrast() public void setContrast(double value) |
The default value is 0.5.
getBiLevel/setBiLevel | |
public boolean getBiLevel() public void setBiLevel(boolean value) |
The default value is false.
getGrayScale/setGrayScale | |
public boolean getGrayScale() public void setGrayScale(boolean value) |
The default value is false.
Method Detail |
---|
setImage | |
public void setImage(java.awt.image.BufferedImage image) throws java.io.IOException |
image
- The image object.setImage | |
public void setImage(java.lang.String fileName) throws java.io.IOException |
fileName
- The image file. Can be a file name or a URL.setImage | |
public void setImage(java.io.InputStream stream) throws java.io.IOException |
stream
- The stream that contains the image.
The stream will be read from
the current position, so one should be careful about stream position.setImage | |
public void setImage(byte[] imageBytes) throws java.io.IOException |
imageBytes
- Bytes of the image.toImage | |
public java.awt.image.BufferedImage toImage() throws java.lang.Exception |
Tries to create a new java.awt.image.BufferedImage object from image bytes every time this method is called. If javax.imageio.ImageReader can't read image bytes (emf, wmf, tiff, etc.) the method returns null.
It is the responsibility of the caller to dispose the image object.
toInputStream | |
public java.io.InputStream toInputStream() throws java.lang.Exception |
If the image bytes are stored in the shape, creates and returns a
If the image is linked and stored in a file, opens the file and returns a
If the image is linked and stored in an external URL, opens the URL and returns a
Is it the responsibility of the caller to dispose the stream object.
save | |
public void save(java.io.OutputStream stream) throws java.lang.Exception |
Is it the responsibility of the caller to dispose the stream object.
stream
- The stream where to save the image to.save | |
public void save(java.lang.String fileName) throws java.lang.Exception |
fileName
- The file name where to save the image.setAttr | |
public void setAttr(int key, java.lang.Object value) |
fetchInheritedAttr | |
public java.lang.Object fetchInheritedAttr(int key) |
getDirectAttr | |
public java.lang.Object getDirectAttr(int key) |
|
ASPOSE home |