ImageType
Contents
[
Hide
]Inheritance: java.lang.Object
public class ImageType
Specifies the type (format) of an image in a Microsoft Word document.
Examples:
Shows how to read WebP image.
Document doc = new Document(getMyDir() + "Document with WebP image.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
Assert.assertEquals(ImageType.WEB_P, shape.getImageData().getImageType());
Shows how to add an image to a shape and check its type.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
BufferedImage image = ImageIO.read(getAsposelogoUri().toURL().openStream());
// The image in the URL is a .gif. Inserting it into a document converts it into a .png.
Shape imgShape = builder.insertImage(image);
Assert.assertEquals(imgShape.getImageData().getImageType(), ImageType.PNG);
Fields
Field | Description |
---|---|
BMP | Windows Bitmap. |
EMF | Windows Enhanced Metafile. |
EPS | Encapsulated PostScript. |
GIF | GIF |
JPEG | JPEG JFIF. |
NO_IMAGE | The is no image data. |
PICT | Macintosh PICT. |
PNG | Portable Network Graphics. |
UNKNOWN | An unknown image type or image type that cannot be directly stored inside a Microsoft Word document. |
WEB_P | WebP. |
WMF | Windows Metafile. |
length |
Methods
Method | Description |
---|---|
fromName(String imageTypeName) | |
getName(int imageType) | |
getValues() | |
toString(int imageType) |
BMP
public static int BMP
Windows Bitmap.
EMF
public static int EMF
Windows Enhanced Metafile.
EPS
public static int EPS
Encapsulated PostScript.
GIF
public static int GIF
GIF
JPEG
public static int JPEG
JPEG JFIF.
NO_IMAGE
public static int NO_IMAGE
The is no image data.
PICT
public static int PICT
Macintosh PICT. An existing image will be preserved in a document, but inserting new PICT images into a document is not supported.
PNG
public static int PNG
Portable Network Graphics.
UNKNOWN
public static int UNKNOWN
An unknown image type or image type that cannot be directly stored inside a Microsoft Word document.
WEB_P
public static int WEB_P
WebP.
WMF
public static int WMF
Windows Metafile.
length
public static int length
fromName(String imageTypeName)
public static int fromName(String imageTypeName)
Parameters:
Parameter | Type | Description |
---|---|---|
imageTypeName | java.lang.String |
Returns: int
getName(int imageType)
public static String getName(int imageType)
Parameters:
Parameter | Type | Description |
---|---|---|
imageType | int |
Returns: java.lang.String
getValues()
public static int[] getValues()
Returns: int[]
toString(int imageType)
public static String toString(int imageType)
Parameters:
Parameter | Type | Description |
---|---|---|
imageType | int |
Returns: java.lang.String