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
(计算给定图片锚点的 EMU 尺寸)
|
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.
(PNG 和 JPEG 的元数据可以包含以毫米为单位的像素宽度。)
|
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 data
(is - 包含图像数据的流)
type
- type of the picture:
Workbook.PICTURE_TYPE_JPEG
,
Workbook.PICTURE_TYPE_PNG
or
Workbook.PICTURE_TYPE_DIB
(type - 图片的类型:Workbook.PICTURE_TYPE_JPEG、Workbook.PICTURE_TYPE_PNG 或 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.
(PNG 和 JPEG 的元数据可以包含以毫米为单位的像素宽度。返回计算为 25.4/HorizontalPixelSize 和 25.4/VerticalPixelSize 的“有效”dpi。其中 25.4 是以英寸为单位的毫米数。)
{horizontalDpi, verticalDpi}
. {96, 96} is the default.
(两个元素的数组:{horizontalDpi,verticalDpi}。 {96, 96} 是默认值。)
java.io.IOException
(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.
(scaleX - 图像宽度与原始宽度相乘的数量。)
scaleY
- the amount by which image height is multiplied relative to the original height.
(scaleY - 图像高度相对于原始高度的乘积量。)
public static java.awt.Dimension getDimensionFromAnchor(Picture picture)
picture
- the picture containing the anchor
(图片 - 包含锚点的图片)
public static double getRowHeightInPixels(Sheet sheet, int rowNum)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.