public class ImageInfo extends Object
Some parameters are redundant, but the constructor receives an 'orthogonal' subset.
ref: http://www.w3.org/TR/PNG/#11IHDR
Modifier and Type | Field and Description |
---|---|
boolean |
alpha
Flag: true if has alpha channel (RGBA/GA)
|
int |
bitDepth
Bits per sample (per channel) in the buffer (1-2-4-8-16).
|
int |
bitspPixel
Bits used for each pixel in the buffer: channel * bitDepth
|
int |
bytesPerRow
ceil(bitspp*cols/8) - does not include filter
|
int |
bytesPixel
rounded up value: this is only used internally for filter
|
int |
channels
Number of channels, as used internally: 3 for RGB, 4 for RGBA, 2 for GA (gray with alpha), 1 for grayscale or
indexed.
|
int |
cols
Cols= Image width, in pixels.
|
boolean |
greyscale
Flag: true if is grayscale (G/GA)
|
boolean |
indexed
Flag: true if image is indexed, i.e., it has a palette
|
static int |
MAX_COLS_ROW
Absolute allowed maximum value for rows and cols (2^24 ~16 million).
|
boolean |
packed
Flag: true if image internally uses less than one byte per sample (bit depth 1-2-4)
|
int |
rows
Rows= Image height, in pixels
|
int |
samplesPerRow
Equals cols * channels
|
int |
samplesPerRowPacked
Amount of "packed samples" : when several samples are stored in a single byte (bitdepth 1,2 4) they are counted as
one "packed sample".
|
Constructor and Description |
---|
ImageInfo(int cols,
int rows,
int bitdepth,
boolean alpha)
Short constructor: assumes truecolor (RGB/RGBA)
|
ImageInfo(int cols,
int rows,
int bitdepth,
boolean alpha,
boolean grayscale,
boolean indexed)
Full constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
long |
getTotalPixels() |
long |
getTotalRawBytes()
Total uncompressed bytes in IDAT, including filter byte.
|
int |
hashCode() |
String |
toString() |
String |
toStringBrief()
Brief info: COLSxROWS[dBITDEPTH][a][p][g] ( the default dBITDEPTH='d8' is ommited)
|
String |
toStringDetail() |
ImageInfo |
withSize(int cols,
int rows)
returns a copy with different size
|
public static final int MAX_COLS_ROW
public final int cols
public final int rows
public final int bitDepth
public final int channels
public final boolean alpha
public final boolean greyscale
public final boolean indexed
public final boolean packed
public final int bitspPixel
public final int bytesPixel
public final int bytesPerRow
public final int samplesPerRow
public final int samplesPerRowPacked
This equals the number of elements in the scanline array if working with packedMode=true
For internal use, client code should rarely access this.
public ImageInfo(int cols, int rows, int bitdepth, boolean alpha)
public ImageInfo(int cols, int rows, int bitdepth, boolean alpha, boolean grayscale, boolean indexed)
cols
- Width in pixelsrows
- Height in pixelsbitdepth
- Bits per sample, in the buffer : 8-16 for RGB true color and greyscalealpha
- Flag: has an alpha channel (RGBA or GA)grayscale
- Flag: is gray scale (any bitdepth, with or without alpha)indexed
- Flag: has palettepublic ImageInfo withSize(int cols, int rows)
cols
- if non-positive, the original is usedrows
- if non-positive, the original is usedpublic long getTotalPixels()
public long getTotalRawBytes()
public String toStringBrief()
public String toStringDetail()
Copyright © 2014. All rights reserved.