public class BufferedImageFactory extends ImageFactory
BufferedImageFactory
is the default implementation of ImageFactory
.Constructor and Description |
---|
BufferedImageFactory() |
Modifier and Type | Method and Description |
---|---|
Image |
fromFile(java.nio.file.Path path)
Gets
Image from file. |
Image |
fromImage(java.lang.Object image)
Gets
Image from varies Java image types. |
Image |
fromInputStream(java.io.InputStream is)
Gets
Image from InputStream . |
Image |
fromNDArray(NDArray array)
|
protected void |
save(java.awt.image.BufferedImage image,
java.io.OutputStream os,
java.lang.String type) |
fromUrl, fromUrl, getInstance, setImageFactory
public Image fromFile(java.nio.file.Path path) throws java.io.IOException
Image
from file.fromFile
in class ImageFactory
path
- the path to the imageImage
java.io.IOException
- Image not found or not readablepublic Image fromInputStream(java.io.InputStream is) throws java.io.IOException
Image
from InputStream
.fromInputStream
in class ImageFactory
is
- InputStream
Image
java.io.IOException
- image cannot be read from input stream.public Image fromImage(java.lang.Object image)
Image
from varies Java image types.
Image can be BufferedImage or BitMap depends on platform
fromImage
in class ImageFactory
image
- the image object.Image
public Image fromNDArray(NDArray array)
fromNDArray
in class ImageFactory
array
- the NDArray with CHW formatImage
protected void save(java.awt.image.BufferedImage image, java.io.OutputStream os, java.lang.String type) throws java.io.IOException
java.io.IOException