public final class ImageUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.awt.Dimension |
getDimensionFromAnchor(Picture picture)
Calculates the dimensions in EMUs for the anchor of the given picture
|
static java.awt.Dimension |
getImageDimension(java.io.InputStream is,
int type)
Return the dimension of this image
|
static int[] |
getResolution(javax.imageio.ImageReader r)
The metadata of PNG and JPEG can contain the width of a pixel in millimeters.
|
static double |
getRowHeightInPixels(Sheet sheet,
int rowNum) |
static java.awt.Dimension |
setPreferredSize(Picture picture,
double scaleX,
double scaleY)
Calculate and set the preferred size (anchor) for this picture.
|
public static java.awt.Dimension getImageDimension(java.io.InputStream is, int type)
is
- the stream containing the image datatype
- type of the picture: Workbook.PICTURE_TYPE_JPEG
,
Workbook.PICTURE_TYPE_PNG
or Workbook.PICTURE_TYPE_DIB
public static int[] getResolution(javax.imageio.ImageReader r) throws java.io.IOException
25.4/HorizontalPixelSize
and 25.4/VerticalPixelSize
. Where 25.4 is the number of mm in inch.{horizontalDpi, verticalDpi}
.
{96, 96} is the default.java.io.IOException
public static java.awt.Dimension setPreferredSize(Picture picture, double scaleX, double scaleY)
scaleX
- the amount by which image width is multiplied relative to the original width.scaleY
- the amount by which image height is multiplied relative to the original height.public static java.awt.Dimension getDimensionFromAnchor(Picture picture)
picture
- the picture containing the anchorpublic static double getRowHeightInPixels(Sheet sheet, int rowNum)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.