public interface Image extends Bounded
Page.Page.getImages()| Modifier and Type | Interface and Description |
|---|---|
static class |
Image.Format
An enumeration of the different formats in which
image data may be produced,
as indicated by Image.dataFormat(). |
| Modifier and Type | Method and Description |
|---|---|
BufferedImage |
bitmap()
Returns a
BufferedImage for this Image that is ready to be drawn to a graphics context. |
Region |
bitmapBounds()
Returns a
Region whose width and height indicate that of the image itself;
its origin coordinates (Region.lx() and Region.by()) will always be
0, 0. |
byte[] |
data()
Returns the data for this image, encoded according to the format
indicated by
Image.dataFormat(); may return null if it is known that the image's
data cannot be decoded without producing an exception. |
Image.Format |
dataFormat()
Returns the format of the image data available from this image's
Image.data() method. |
BufferedImage bitmap()
BufferedImage for this Image that is ready to be drawn to a graphics context.
This method may return null if it is known that the image's
data cannot be decoded without producing an exception.
BufferedImage object returned from this method provides a .getBitmap()
method that efficiently produces a .NET System.Drawing.Bitmap object. So, the pattern
you'd typically use with Image.bitmap() is e.g.:
Page page = pdf.getPage(0);
Image image = page.getImages().get(0).bitmap();
if (image != null)
{
System.Drawing.Bitmap bmp = image.getBitmap();
// ...code continues...
}
Region bitmapBounds()
Region whose width and height indicate that of the image itself;
its origin coordinates (Region.lx() and Region.by()) will always be
0, 0.
This does not represent the apparent bounds of the image when positioned
on the page; use Bounded.bounds() for that.
byte[] data()
Image.dataFormat(); may return null if it is known that the image's
data cannot be decoded without producing an exception.Image.Format dataFormat()
Image.data() method.