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