Class PngImage
java.lang.Object
com.itextpdf.text.pdf.codec.PngImage
Reads a PNG image. All types of PNG can be read.
It is based in part in the JAI codec.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) PdfDictionary(package private) int(package private) intstatic final StringA PNG marker.(package private) byte[](package private) int(package private) int(package private) DataInputStream(package private) int(package private) int(package private) intstatic final StringA PNG marker.(package private) float(package private) boolean(package private) boolean(package private) int(package private) ICC_Profilestatic final StringA PNG marker.(package private) PngImage.NewByteArrayOutputStreamstatic final StringA PNG marker.static final StringA PNG marker.static final StringA PNG marker.(package private) byte[](package private) int(package private) PdfNameprivate static final PdfName[](package private) int(package private) InputStream(package private) booleanstatic final StringA PNG marker.static final StringA PNG marker.private static final intprivate static final intprivate static final intprivate static final intprivate static final intstatic final int[]Some PNG specific values.(package private) byte[]static final StringA PNG marker.(package private) byte[](package private) intprivate static final int(package private) int(package private) intstatic final StringA PNG marker.(package private) int(package private) float(package private) float(package private) float(package private) float(package private) float(package private) float(package private) float(package private) float(package private) float -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void(package private) booleanprivate static voiddecodeAverageFilter(byte[] curr, byte[] prev, int count, int bpp) (package private) voidprivate static voiddecodePaethFilter(byte[] curr, byte[] prev, int count, int bpp) (package private) voiddecodePass(int xOffset, int yOffset, int xStep, int yStep, int passWidth, int passHeight) private static voiddecodeSubFilter(byte[] curr, int count, int bpp) private static voiddecodeUpFilter(byte[] curr, byte[] prev, int count) (package private) PdfObjectprivate int(package private) ImagegetImage()static ImagegetImage(byte[] data) Reads a PNG from a byte array.static ImagegetImage(InputStream is) Reads a PNG from a stream.static ImageReads a PNG from a file.static ImageReads a PNG from an url.static final intgetInt(InputStream is) Gets anintfrom anInputStream.(package private) int[]getPixel(byte[] curr) (package private) static intgetPixel(byte[] image, int x, int y, int bitDepth, int bytesPerRow) static final StringgetString(InputStream is) Gets aStringfrom anInputStream.static final intgetWord(InputStream is) Gets awordfrom anInputStream.private static intpaethPredictor(int a, int b, int c) (package private) voidprocessPixels(byte[] curr, int xOffset, int step, int y, int width) (package private) voidreadPng()(package private) static voidsetPixel(byte[] image, int[] data, int offset, int size, int x, int y, int bitDepth, int bytesPerRow)
-
Field Details
-
PNGID
public static final int[] PNGIDSome PNG specific values. -
IHDR
-
PLTE
-
IDAT
-
IEND
-
tRNS
-
pHYs
-
gAMA
-
cHRM
-
sRGB
-
iCCP
-
TRANSFERSIZE
private static final int TRANSFERSIZE- See Also:
-
PNG_FILTER_NONE
private static final int PNG_FILTER_NONE- See Also:
-
PNG_FILTER_SUB
private static final int PNG_FILTER_SUB- See Also:
-
PNG_FILTER_UP
private static final int PNG_FILTER_UP- See Also:
-
PNG_FILTER_AVERAGE
private static final int PNG_FILTER_AVERAGE- See Also:
-
PNG_FILTER_PAETH
private static final int PNG_FILTER_PAETH- See Also:
-
intents
-
is
InputStream is -
dataStream
DataInputStream dataStream -
width
int width -
height
int height -
bitDepth
int bitDepth -
colorType
int colorType -
compressionMethod
int compressionMethod -
filterMethod
int filterMethod -
interlaceMethod
int interlaceMethod -
additional
PdfDictionary additional -
image
byte[] image -
smask
byte[] smask -
trans
byte[] trans -
idat
-
dpiX
int dpiX -
dpiY
int dpiY -
XYRatio
float XYRatio -
genBWMask
boolean genBWMask -
palShades
boolean palShades -
transRedGray
int transRedGray -
transGreen
int transGreen -
transBlue
int transBlue -
inputBands
int inputBands -
bytesPerPixel
int bytesPerPixel -
colorTable
byte[] colorTable -
gamma
float gamma -
hasCHRM
boolean hasCHRM -
xW
float xW -
yW
float yW -
xR
float xR -
yR
float yR -
xG
float xG -
yG
float yG -
xB
float xB -
yB
float yB -
intent
PdfName intent -
icc_profile
ICC_Profile icc_profile
-
-
Constructor Details
-
PngImage
PngImage(InputStream is) Creates a new instance of PngImage
-
-
Method Details
-
getImage
Reads a PNG from an url.- Parameters:
url- the url- Returns:
- the image
- Throws:
IOException- on error
-
getImage
Reads a PNG from a stream.- Parameters:
is- the stream- Returns:
- the image
- Throws:
IOException- on error
-
getImage
Reads a PNG from a file.- Parameters:
file- the file- Returns:
- the image
- Throws:
IOException- on error
-
getImage
Reads a PNG from a byte array.- Parameters:
data- the byte array- Returns:
- the image
- Throws:
IOException- on error
-
checkMarker
-
readPng
- Throws:
IOException
-
getColorspace
PdfObject getColorspace() -
getImage
- Throws:
IOException
-
decodeIdat
void decodeIdat() -
decodePass
void decodePass(int xOffset, int yOffset, int xStep, int yStep, int passWidth, int passHeight) -
processPixels
void processPixels(byte[] curr, int xOffset, int step, int y, int width) -
getPixel
static int getPixel(byte[] image, int x, int y, int bitDepth, int bytesPerRow) -
setPixel
static void setPixel(byte[] image, int[] data, int offset, int size, int x, int y, int bitDepth, int bytesPerRow) -
getPixel
int[] getPixel(byte[] curr) -
getExpectedIccNumberOfComponents
private int getExpectedIccNumberOfComponents() -
checkIccProfile
private void checkIccProfile() -
decodeSubFilter
private static void decodeSubFilter(byte[] curr, int count, int bpp) -
decodeUpFilter
private static void decodeUpFilter(byte[] curr, byte[] prev, int count) -
decodeAverageFilter
private static void decodeAverageFilter(byte[] curr, byte[] prev, int count, int bpp) -
paethPredictor
private static int paethPredictor(int a, int b, int c) -
decodePaethFilter
private static void decodePaethFilter(byte[] curr, byte[] prev, int count, int bpp) -
getInt
Gets anintfrom anInputStream.- Parameters:
is- anInputStream- Returns:
- the value of an
int - Throws:
IOException
-
getWord
Gets awordfrom anInputStream.- Parameters:
is- anInputStream- Returns:
- the value of an
int - Throws:
IOException
-
getString
Gets aStringfrom anInputStream.- Parameters:
is- anInputStream- Returns:
- the value of an
int - Throws:
IOException
-