public final class ImageDataFactory extends Object
Modifier and Type | Method and Description |
---|---|
static ImageData |
create(byte[] bytes)
Create an ImageData instance representing the image from the image bytes.
|
static ImageData |
create(byte[] bytes, boolean recoverImage)
Create an ImageData instance representing the image from the image bytes.
|
static ImageData |
create(Image image, Color color)
Gets an instance of an Image from a java.awt.Image
|
static ImageData |
create(Image image, Color color, boolean forceBW)
Gets an instance of an Image from a java.awt.Image.
|
static ImageData |
create(int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data, int[] transparency)
Create an ImageData instance from the passed parameters.
|
static ImageData |
create(int width, int height, int components, int bpc, byte[] data, int[] transparency)
Create an ImageData instance from the passed parameters.
|
static ImageData |
create(String filename)
Create an ImageData instance representing the image from the specified file.
|
static ImageData |
create(String filename, boolean recoverImage)
Create an ImageData instance representing the image from the specified file.
|
static ImageData |
create(URL url)
Create an ImageData instance representing the image from the file located at the specified url.
|
static ImageData |
create(URL url, boolean recoverImage)
Create an ImageData instance representing the image from the file located at the specified url.
|
static ImageData |
createBmp(byte[] bytes, boolean noHeader, int size)
Get a bitmap ImageData instance from the provided bytes.
|
static ImageData |
createBmp(URL url, boolean noHeader, int size)
Get a bitmap ImageData instance from the specified url.
|
static GifImageData |
createGif(byte[] bytes)
Return a GifImage object.
|
static ImageData |
createGifFrame(byte[] bytes, int frame)
Returns a specified frame of the gif image
|
static ImageData |
createGifFrame(URL url, int frame)
Returns a specified frame of the gif image
|
static List<ImageData> |
createGifFrames(byte[] bytes)
Returns List of gif image frames
|
static List<ImageData> |
createGifFrames(byte[] bytes, int[] frameNumbers)
Returns List of gif image frames
|
static List<ImageData> |
createGifFrames(URL url)
Returns List of gif image frames
|
static List<ImageData> |
createGifFrames(URL url, int[] frameNumbers)
Returns List of gif image frames
|
static ImageData |
createJbig2(byte[] bytes, int page) |
static ImageData |
createJbig2(URL url, int page) |
static ImageData |
createJpeg(byte[] bytes) |
static ImageData |
createJpeg(URL url)
Create a ImageData instance from a Jpeg image url
|
static ImageData |
createJpeg2000(byte[] bytes) |
static ImageData |
createJpeg2000(URL url) |
static ImageData |
createPng(byte[] bytes) |
static ImageData |
createPng(URL url) |
static ImageData |
createRawImage(byte[] bytes) |
static ImageData |
createTiff(byte[] bytes, boolean recoverFromImageError, int page, boolean direct) |
static ImageData |
createTiff(URL url, boolean recoverFromImageError, int page, boolean direct) |
static boolean |
isSupportedType(byte[] source)
Checks if the type of image (based on first 8 bytes) is supported by factory.
|
static boolean |
isSupportedType(URL source)
Checks if the type of image (based on first 8 bytes) is supported by factory.
|
public static ImageData create(byte[] bytes, boolean recoverImage)
bytes
- byte representation of the image.
recoverImage
- whether to recover from a image error (for TIFF-images)
public static ImageData create(byte[] bytes)
bytes
- byte representation of the image.
public static ImageData create(URL url, boolean recoverImage)
url
- location of the image
recoverImage
- whether to recover from a image error (for TIFF-images)
public static ImageData create(URL url)
url
- location of the image
public static ImageData create(String filename, boolean recoverImage) throws MalformedURLException
filename
- filename of the file containing the image
recoverImage
- whether to recover from a image error (for TIFF-images)
MalformedURLException
public static ImageData create(String filename) throws MalformedURLException
filename
- filename of the file containing the image
MalformedURLException
public static ImageData create(int width, int height, boolean reverseBits, int typeCCITT, int parameters, byte[] data, int[] transparency)
width
- width of the image in pixels
height
- height of the image in pixels
reverseBits
- whether to reverse the bits stored in data (TIFF images).
typeCCITT
- Type of CCITT encoding
parameters
- colour space parameters
data
- array containing raw image data
transparency
- array containing transparency information
public static ImageData create(int width, int height, int components, int bpc, byte[] data, int[] transparency)
width
- width of the image in pixels
height
- height of the image in pixels
components
- colour space components
bpc
- bits per colour.
data
- array containing raw image data
transparency
- array containing transparency information
public static ImageData create(Image image, Color color) throws IOException
image
- the java.awt.Image to convert
color
- if different from null
the transparency pixels are replaced by this color
IOException
public static ImageData create(Image image, Color color, boolean forceBW) throws IOException
image
- the java.awt.Image
to convert
color
- if different from null
the transparency pixels are replaced by this color
forceBW
- if true
the image is treated as black and white
IOException
public static ImageData createBmp(URL url, boolean noHeader, int size)
url
- location of the image.
noHeader
- Whether the image contains a header.
size
- size of the image
public static ImageData createBmp(byte[] bytes, boolean noHeader, int size)
bytes
- array containing the raw image data
noHeader
- Whether the image contains a header.
size
- size of the image
public static GifImageData createGif(byte[] bytes)
bytes
- array containing the raw image data
public static ImageData createGifFrame(URL url, int frame)
url
- url of gif image
frame
- number of frame to be returned
public static ImageData createGifFrame(byte[] bytes, int frame)
bytes
- byte array of gif image
frame
- number of frame to be returned
public static List<ImageData> createGifFrames(byte[] bytes, int[] frameNumbers)
List
of gif image frames
bytes
- byte array of gif image
frameNumbers
- array of frame numbers of gif image
public static List<ImageData> createGifFrames(URL url, int[] frameNumbers)
List
of gif image frames
url
- url of gif image
frameNumbers
- array of frame numbers of gif image
public static List<ImageData> createGifFrames(byte[] bytes)
List
of gif image frames
bytes
- byte array of gif image
public static List<ImageData> createGifFrames(URL url)
List
of gif image frames
url
- url of gif image
public static ImageData createJbig2(byte[] bytes, int page)
public static ImageData createJpeg(URL url)
url
- URL
public static ImageData createJpeg(byte[] bytes)
public static ImageData createJpeg2000(byte[] bytes)
public static ImageData createPng(byte[] bytes)
public static ImageData createTiff(URL url, boolean recoverFromImageError, int page, boolean direct)
public static ImageData createTiff(byte[] bytes, boolean recoverFromImageError, int page, boolean direct)
public static ImageData createRawImage(byte[] bytes)
public static boolean isSupportedType(byte[] source)
true
it doesn't means that create(byte[])
won't throw exception
source
- image raw bytes
true
if first eight bytes are recognised by factory as valid image type and false
otherwise
public static boolean isSupportedType(URL source)
true
it doesn't means that create(byte[])
won't throw exception
source
- image URL
true
if first eight bytes are recognised by factory as valid image type and false
otherwise
Copyright © 1998–2020 iText Group NV. All rights reserved.