public class ImageIOUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
canDisplay(BufferedImage image) |
static void |
centerWindow(Window w) |
static ColorModel |
createGrayscaleColorModel(boolean invert) |
static void |
doubleToByteBuffer(double[] doubleData,
byte[] byteData,
int pixelStride,
int numBands)
Converts the float data to byte data, and sets the values in the byteData buffer
|
static double[] |
findMinAndMax(double[] buffer,
int pixelStride,
int numBands) |
static float[] |
findMinAndMax(float[] buffer,
int pixelStride,
int numBands) |
static int[] |
findMinAndMax(short[] buffer,
int pixelStride,
int numBands) |
static void |
floatToByteBuffer(float[] floatData,
byte[] byteData,
int pixelStride,
int numBands)
Converts the float data to byte data, and sets the values in the byteData buffer
|
static List<File> |
getFiles(String[] filesOrDirs,
String[] extensions)
Returns a list of Files contained in the given String array of files or directories.
|
static ImageReader |
getImageReader(File file)
Returns an ImageReader given the input file
|
static ImageReader |
getImageReader(String filename)
Returns an ImageReader given the input filename
|
static ImageReader |
getImageReader(String format,
Object input)
Returns an ImageReader given the format, and sets the input source
|
static ImageWriter |
getImageWriter(File file)
Returns an ImageWriter given the input file
|
static ImageWriter |
getImageWriter(String filename)
Returns an ImageWriter given the output filename
|
static String |
getPackageName(Class clazz) |
static void |
main(String[] args) |
static WritableRaster |
makeGenericBandedWritableRaster(int numElems,
int numLines,
int numBands,
int dataType)
Returns a generic banded WritableRaster
|
static WritableRaster |
makeGenericPixelInterleavedWritableRaster(int numElems,
int numLines,
int numBands,
int dataType)
Returns a generic pixel interleaved WritableRaster
|
static int |
makeUnsigned(byte b)
Turns a signed byte into an unsigned one.
|
static BufferedImage |
rasterToBufferedImage(Raster raster,
ImageTypeSpecifier imageType)
Utility method for creating a BufferedImage from a source raster Currently only Float->Byte and Byte->Byte are supported.
|
static void |
shortToByteBuffer(short[] shortData,
byte[] byteData,
int pixelStride,
int numBands)
Converts the float data to byte data, and sets the values in the byteData buffer
|
static JFrame |
showImage(BufferedImage image,
String title) |
static JFrame |
showImage(BufferedImage image,
String title,
boolean fitToScreen) |
public static ImageReader getImageReader(String filename) throws IOException
filename
- IOException
public static ImageReader getImageReader(File file) throws IOException
file
- IOException
public static ImageReader getImageReader(String format, Object input) throws IOException
file
- IOException
public static ImageWriter getImageWriter(String filename) throws IOException
filename
- IOException
public static ImageWriter getImageWriter(File file) throws IOException
file
- IOException
public static boolean canDisplay(BufferedImage image)
public static List<File> getFiles(String[] filesOrDirs, String[] extensions)
filesOrDirs
- extensions
- public static JFrame showImage(BufferedImage image, String title)
public static JFrame showImage(BufferedImage image, String title, boolean fitToScreen)
public static void centerWindow(Window w)
public static ColorModel createGrayscaleColorModel(boolean invert)
public static float[] findMinAndMax(float[] buffer, int pixelStride, int numBands)
public static double[] findMinAndMax(double[] buffer, int pixelStride, int numBands)
public static int[] findMinAndMax(short[] buffer, int pixelStride, int numBands)
public static WritableRaster makeGenericBandedWritableRaster(int numElems, int numLines, int numBands, int dataType)
numElems
- numLines
- bandOffsets
- dataType
- public static WritableRaster makeGenericPixelInterleavedWritableRaster(int numElems, int numLines, int numBands, int dataType)
numElems
- numLines
- bandOffsets
- dataType
- public static void floatToByteBuffer(float[] floatData, byte[] byteData, int pixelStride, int numBands)
floatData
- byteData
- public static void doubleToByteBuffer(double[] doubleData, byte[] byteData, int pixelStride, int numBands)
doubleData
- byteData
- public static void shortToByteBuffer(short[] shortData, byte[] byteData, int pixelStride, int numBands)
shortData
- byteData
- public static BufferedImage rasterToBufferedImage(Raster raster, ImageTypeSpecifier imageType)
UnsupportedOperationException
if the conversion is not supported.raster
- imageType
- public static int makeUnsigned(byte b)
b
- The byte to readpublic static void main(String[] args)
Copyright © 2006–2014 GeoSolutions. All rights reserved.