- java.lang.Object
-
- com.itextpdf.text.pdf.codec.PngImage
-
public class PngImage extends java.lang.ObjectReads a PNG image. All types of PNG can be read.It is based in part in the JAI codec.
- Author:
- Paulo Soares (psoares@consiste.pt)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringcHRMA PNG marker.static java.lang.StringgAMAA PNG marker.static java.lang.StringiCCPA PNG marker.static java.lang.StringIDATA PNG marker.static java.lang.StringIENDA PNG marker.static java.lang.StringIHDRA PNG marker.static java.lang.StringpHYsA PNG marker.static java.lang.StringPLTEA PNG marker.static int[]PNGIDSome PNG specific values.static java.lang.StringsRGBA PNG marker.static java.lang.StringtRNSA PNG marker.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ImagegetImage(byte[] data)Reads a PNG from a byte array.static ImagegetImage(java.io.InputStream is)Reads a PNG from a stream.static ImagegetImage(java.lang.String file)Reads a PNG from a file.static ImagegetImage(java.net.URL url)Reads a PNG from an url.static intgetInt(java.io.InputStream is)Gets anintfrom anInputStream.static java.lang.StringgetString(java.io.InputStream is)Gets aStringfrom anInputStream.static intgetWord(java.io.InputStream is)Gets awordfrom anInputStream.
-
-
-
Field Detail
-
PNGID
public static final int[] PNGID
Some PNG specific values.
-
IHDR
public static final java.lang.String IHDR
A PNG marker.- See Also:
- Constant Field Values
-
PLTE
public static final java.lang.String PLTE
A PNG marker.- See Also:
- Constant Field Values
-
IDAT
public static final java.lang.String IDAT
A PNG marker.- See Also:
- Constant Field Values
-
IEND
public static final java.lang.String IEND
A PNG marker.- See Also:
- Constant Field Values
-
tRNS
public static final java.lang.String tRNS
A PNG marker.- See Also:
- Constant Field Values
-
pHYs
public static final java.lang.String pHYs
A PNG marker.- See Also:
- Constant Field Values
-
gAMA
public static final java.lang.String gAMA
A PNG marker.- See Also:
- Constant Field Values
-
cHRM
public static final java.lang.String cHRM
A PNG marker.- See Also:
- Constant Field Values
-
sRGB
public static final java.lang.String sRGB
A PNG marker.- See Also:
- Constant Field Values
-
iCCP
public static final java.lang.String iCCP
A PNG marker.- See Also:
- Constant Field Values
-
-
Method Detail
-
getImage
public static Image getImage(java.net.URL url) throws java.io.IOException
Reads a PNG from an url.- Parameters:
url- the url- Returns:
- the image
- Throws:
java.io.IOException- on error
-
getImage
public static Image getImage(java.io.InputStream is) throws java.io.IOException
Reads a PNG from a stream.- Parameters:
is- the stream- Returns:
- the image
- Throws:
java.io.IOException- on error
-
getImage
public static Image getImage(java.lang.String file) throws java.io.IOException
Reads a PNG from a file.- Parameters:
file- the file- Returns:
- the image
- Throws:
java.io.IOException- on error
-
getImage
public static Image getImage(byte[] data) throws java.io.IOException
Reads a PNG from a byte array.- Parameters:
data- the byte array- Returns:
- the image
- Throws:
java.io.IOException- on error
-
getInt
public static final int getInt(java.io.InputStream is) throws java.io.IOExceptionGets anintfrom anInputStream.- Parameters:
is- anInputStream- Returns:
- the value of an
int - Throws:
java.io.IOException
-
getWord
public static final int getWord(java.io.InputStream is) throws java.io.IOExceptionGets awordfrom anInputStream.- Parameters:
is- anInputStream- Returns:
- the value of an
int - Throws:
java.io.IOException
-
getString
public static final java.lang.String getString(java.io.InputStream is) throws java.io.IOExceptionGets aStringfrom anInputStream.- Parameters:
is- anInputStream- Returns:
- the value of an
int - Throws:
java.io.IOException
-
-