Class ImageUtil


  • public class ImageUtil
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ImageUtil.AlignedImage  
    • Constructor Summary

      Constructors 
      Constructor Description
      ImageUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ImageUtil.AlignedImage alignImage​(java.awt.image.BufferedImage sourceImage, float[] latitudes, float[] longitudes)
      Reprojects an image into an aligned image, one with edges of constant latitude and longitude.
      static ImageUtil.AlignedImage alignImage​(java.awt.image.BufferedImage sourceImage, float[] latitudes, float[] longitudes, Sector sector, java.awt.Dimension dimension)
      Reprojects an image into an aligned image, one with edges of constant latitude and longitude.
      static void alignImageDump​(java.awt.image.BufferedImage sourceImage, float[] latitudes, float[] longitudes)  
      static java.nio.ByteBuffer asJPEG​(DataRaster raster)  
      static java.nio.ByteBuffer asPNG​(DataRaster raster)  
      static java.awt.image.BufferedImage[] buildMipmaps​(java.awt.image.BufferedImage image)
      Builds a sequence of mipmaps for the specified image.
      static java.awt.image.BufferedImage[] buildMipmaps​(java.awt.image.BufferedImage image, int mipmapImageType, int maxLevel)
      Builds a sequence of mipmaps for the specified image.
      static Sector calcBoundingBoxForUTM​(AVList params)  
      protected static void close​(javax.imageio.stream.ImageOutputStream ios)  
      static void computeBestFittingControlPoints4​(java.awt.geom.Point2D[] imagePoints, LatLon[] geoPoints, java.awt.geom.Point2D[] outImagePoints, LatLon[] outGeoPoints)
      Computes which three control points out of four provide the best estimate an image's geographic location.
      static java.util.List<LatLon> computeImageCorners​(int imageWidth, int imageHeight, Matrix imageToGeographic)
      Returns the geographic corners of an image with the specified dimensions, and a transform that maps image coordinates to geographic coordinates.
      static long computeSizeInBytes​(java.awt.image.BufferedImage image)
      Returns the size in bytes of the specified image.
      static java.awt.image.BufferedImage convertToPowerOfTwoImage​(java.awt.image.BufferedImage image, boolean scaleToFit)
      Returns a copy of the specified image such that the new dimensions are powers of two.
      static java.awt.image.BufferedImage createCompatibleImage​(int width, int height, int transparency)  
      protected static java.awt.GraphicsConfiguration getDefaultGraphicsConfiguration()  
      static int getMaxMipmapLevel​(int width, int height)
      Returns the maximum desired mip level for an image with dimensions width and height.
      static int getMipmapType​(int imageType)
      Returns an image type appropriate for generating mipmaps.
      static void getScaledCopy​(java.awt.image.BufferedImage image, java.awt.image.BufferedImage canvas)
      Draws the specified image onto the canvas, scaling or stretching the image to fit the canvas.
      static int interpolateColor​(double x, double y, int c0, int c1, int c2, int c3)
      Performs bilinear interpolation of 32-bit colors over a convex quadrilateral.
      protected static boolean isCompatibleImage​(java.awt.image.BufferedImage image)  
      static java.awt.image.BufferedImage mapColors​(java.awt.image.BufferedImage sourceImage, int[] originalColors, int[] newColors)  
      static java.awt.image.BufferedImage mapColors​(java.nio.ByteBuffer imageBuffer, int originalColor, int newColor)  
      static java.awt.image.BufferedImage mapTransparencyColors​(java.awt.image.BufferedImage sourceImage, int[] originalColors)  
      static java.awt.image.BufferedImage mapTransparencyColors​(java.nio.ByteBuffer imageBuffer, int[] originalColors)  
      static void mergeImage​(Sector canvasSector, Sector imageSector, double aspectRatio, java.awt.image.BufferedImage image, java.awt.image.BufferedImage canvas)
      Merge an image into another image.
      static AVList openSpatialImage​(java.io.File imageFile)
      Opens a spatial image.
      static AVList openSpatialImage​(java.io.File imageFile, int interpolation_mode)
      Opens a spatial image.
      static Sector positionImage​(java.awt.image.BufferedImage sourceImage, java.awt.Point[] imagePoints, LatLon[] geoPoints, java.awt.image.BufferedImage destImage)  
      static Sector positionImage3​(java.awt.image.BufferedImage sourceImage, java.awt.Point[] imagePoints, LatLon[] geoPoints, java.awt.image.BufferedImage destImage)  
      static Sector positionImage4​(java.awt.image.BufferedImage sourceImage, java.awt.Point[] imagePoints, LatLon[] geoPoints, java.awt.image.BufferedImage destImage)  
      static AVList readGeoKeys​(gov.nasa.worldwind.formats.tiff.GeotiffReader reader, int imageIndex, AVList values)
      Reads Geo-referenced metadata from Geo-TIFF file
      static void reprojectUtmToGeographic​(AVList values, int mode)
      Reprojects an imge in UTM projection to Geo/WGS84.
      static java.awt.image.BufferedImage toCompatibleImage​(java.awt.image.BufferedImage image)  
      static java.awt.image.BufferedImage trimImage​(java.awt.image.BufferedImage image)
      Returns a copy of the specified image with any fully-transparent borders removed.
      static java.awt.image.BufferedImage visualize​(BufferWrapperRaster raster)
      Converts a non-imagery data raster (elevations) to visually representable image raster.
      static Sector warpImageWithControlPoints​(java.awt.image.BufferedImage sourceImage, java.awt.geom.Point2D[] imagePoints, LatLon[] geoPoints, java.awt.image.BufferedImage destImage)
      Convenience method for transforming a georeferenced source image into a geographically aligned destination image.
      static Sector warpImageWithControlPoints3​(java.awt.image.BufferedImage sourceImage, java.awt.geom.Point2D[] imagePoints, LatLon[] geoPoints, java.awt.image.BufferedImage destImage)
      Transforms a georeferenced source image into a geographically aligned destination image.
      static Sector warpImageWithControlPoints4​(java.awt.image.BufferedImage sourceImage, java.awt.geom.Point2D[] imagePoints, LatLon[] geoPoints, java.awt.image.BufferedImage destImage)
      Transforms a georeferenced source image into a geographically aligned destination image.
      static void warpImageWithTransform​(java.awt.image.BufferedImage image, java.awt.image.BufferedImage canvas, Matrix canvasToImageTransform)
      Rasterizes the image into the canvas, given a transform that maps canvas coordinates to image coordinates.
      static Sector warpImageWithWorldFile​(java.awt.image.BufferedImage sourceImage, AVList worldFileParams, java.awt.image.BufferedImage destImage)
      Transforms a georeferenced source image into a geographically aligned destination image.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NEAREST_NEIGHBOR_INTERPOLATION

        public static int NEAREST_NEIGHBOR_INTERPOLATION
      • BILINEAR_INTERPOLATION

        public static int BILINEAR_INTERPOLATION
      • IMAGE_TILE_SIZE

        public static int IMAGE_TILE_SIZE
      • TRANSPARENT

        public static java.awt.Color TRANSPARENT
    • Constructor Detail

      • ImageUtil

        public ImageUtil()
    • Method Detail

      • getScaledCopy

        public static void getScaledCopy​(java.awt.image.BufferedImage image,
                                         java.awt.image.BufferedImage canvas)
        Draws the specified image onto the canvas, scaling or stretching the image to fit the canvas. This will apply a bilinear filter to the image if any scaling or stretching is necessary.
        Parameters:
        image - the BufferedImage to draw, potentially scaling or stretching to fit the canvas.
        canvas - the BufferedImage to receive the scaled or stretched image.
        Throws:
        java.lang.IllegalArgumentException - if either image or canvas is null.
      • warpImageWithTransform

        public static void warpImageWithTransform​(java.awt.image.BufferedImage image,
                                                  java.awt.image.BufferedImage canvas,
                                                  Matrix canvasToImageTransform)
        Rasterizes the image into the canvas, given a transform that maps canvas coordinates to image coordinates.
        Parameters:
        image - the source image.
        canvas - the image to receive the transformed source image.
        canvasToImageTransform - Matrix that maps a canvas coordinates to image coordinates.
        Throws:
        java.lang.IllegalArgumentException - if any of image, canvas, or canvasToImageTransform are null.
      • warpImageWithControlPoints

        public static Sector warpImageWithControlPoints​(java.awt.image.BufferedImage sourceImage,
                                                        java.awt.geom.Point2D[] imagePoints,
                                                        LatLon[] geoPoints,
                                                        java.awt.image.BufferedImage destImage)
        Convenience method for transforming a georeferenced source image into a geographically aligned destination image. The source image is georeferenced by either three four control points. Each control point maps a location in the source image to a geographic location. This is equivalent to calling {#transformConstrainedImage3} or {#transformConstrainedImage4}, depending on the number of control points.
        Parameters:
        sourceImage - the source image to transform.
        imagePoints - three or four control points in the source image.
        geoPoints - three or four geographic locations corresponding to each source control point.
        destImage - the destination image to receive the transformed source imnage.
        Returns:
        bounding sector for the geographically aligned destination image.
        Throws:
        java.lang.IllegalArgumentException - if any of sourceImage, destImage, imagePoints or geoPoints is null, or if either imagePoints or geoPoints have length less than 3.
      • warpImageWithControlPoints4

        public static Sector warpImageWithControlPoints4​(java.awt.image.BufferedImage sourceImage,
                                                         java.awt.geom.Point2D[] imagePoints,
                                                         LatLon[] geoPoints,
                                                         java.awt.image.BufferedImage destImage)
        Transforms a georeferenced source image into a geographically aligned destination image. The source image is georeferenced by four control points. Each control point maps a location in the source image to a geographic location.
        Parameters:
        sourceImage - the source image to transform.
        imagePoints - four control points in the source image.
        geoPoints - four geographic locations corresponding to each source control point.
        destImage - the destination image to receive the transformed source imnage.
        Returns:
        bounding sector for the geographically aligned destination image.
        Throws:
        java.lang.IllegalArgumentException - if any of sourceImage, destImage, imagePoints or geoPoints is null, or if either imagePoints or geoPoints have length less than 4.
      • warpImageWithControlPoints3

        public static Sector warpImageWithControlPoints3​(java.awt.image.BufferedImage sourceImage,
                                                         java.awt.geom.Point2D[] imagePoints,
                                                         LatLon[] geoPoints,
                                                         java.awt.image.BufferedImage destImage)
        Transforms a georeferenced source image into a geographically aligned destination image. The source image is georeferenced by three control points. Each control point maps a location in the source image to a geographic location.
        Parameters:
        sourceImage - the source image to transform.
        imagePoints - three control points in the source image.
        geoPoints - three geographic locations corresponding to each source control point.
        destImage - the destination image to receive the transformed source imnage.
        Returns:
        bounding sector for the geographically aligned destination image.
        Throws:
        java.lang.IllegalArgumentException - if any of sourceImage, destImage, imagePoints or geoPoints is null, or if either imagePoints or geoPoints have length less than 3.
      • warpImageWithWorldFile

        public static Sector warpImageWithWorldFile​(java.awt.image.BufferedImage sourceImage,
                                                    AVList worldFileParams,
                                                    java.awt.image.BufferedImage destImage)
        Transforms a georeferenced source image into a geographically aligned destination image. The source image is georeferenced by a world file, which defines an affine transform from source coordinates to geographic coordinates.
        Parameters:
        sourceImage - the source image to transform.
        worldFileParams - world file parameters which define an affine transform.
        destImage - the destination image to receive the transformed source imnage.
        Returns:
        bounding sector for the geographically aligned destination image.
        Throws:
        java.lang.IllegalArgumentException - if any of sourceImage, destImage or worldFileParams is null.
      • computeBestFittingControlPoints4

        public static void computeBestFittingControlPoints4​(java.awt.geom.Point2D[] imagePoints,
                                                            LatLon[] geoPoints,
                                                            java.awt.geom.Point2D[] outImagePoints,
                                                            LatLon[] outGeoPoints)
        Computes which three control points out of four provide the best estimate an image's geographic location. The result is placed in the output parameters outImagePoints and outGeoPoints, both of which must be non-null and at least length 3.
        Parameters:
        imagePoints - four control points in the image.
        geoPoints - four geographic locations corresponding to the four imagePoints.
        outImagePoints - three control points that best estimate the image's location.
        outGeoPoints - three geographic locations corresponding to the three outImagePoints.
        Throws:
        java.lang.IllegalArgumentException - if any of imagePoints, geoPoints, outImagePoints or outGeoPoints is null, or if imagePoints or geoPoints have length less than 4, or if outImagePoints or outGeoPoints have length less than 3.
      • computeImageCorners

        public static java.util.List<LatLon> computeImageCorners​(int imageWidth,
                                                                 int imageHeight,
                                                                 Matrix imageToGeographic)
        Returns the geographic corners of an image with the specified dimensions, and a transform that maps image coordinates to geographic coordinates.
        Parameters:
        imageWidth - width of the image grid.
        imageHeight - height of the image grid.
        imageToGeographic - Matrix that maps image coordinates to geographic coordinates.
        Returns:
        List of the image's corner locations in geographic coordinates.
        Throws:
        java.lang.IllegalArgumentException - if either imageWidth or imageHeight are less than 1, or if imageToGeographic is null.
      • mergeImage

        public static void mergeImage​(Sector canvasSector,
                                      Sector imageSector,
                                      double aspectRatio,
                                      java.awt.image.BufferedImage image,
                                      java.awt.image.BufferedImage canvas)
        Merge an image into another image. This method is typically used to assemble a composite, seamless image from several individual images. The receiving image, called here the canvas because it's analogous to the Photoshop notion of a canvas, merges the incoming image according to the specified aspect ratio.
        Parameters:
        canvasSector - the sector defining the canvas' location and range.
        imageSector - the sector defining the image's locaion and range.
        aspectRatio - the aspect ratio, width/height, of the assembled image. If the aspect ratio is greater than or equal to one, the assembled image uses the full width of the canvas; the height used is proportional to the inverse of the aspect ratio. If the aspect ratio is less than one, the full height of the canvas is used; the width used is proportional to the aspect ratio.

        The aspect ratio is typically used to maintain consistent width and height units while assembling multiple images into a canvas of a different aspect ratio than the canvas sector, such as drawing a non-square region into a 1024x1024 canvas. An aspect ratio of 1 causes the incoming images to be stretched as necessary in one dimension to match the aspect ratio of the canvas sector.

        image - the image to merge into the canvas.
        canvas - the canvas into which the images are merged. The canvas is not changed if the specified image and canvas sectors are disjoint.
        Throws:
        java.lang.IllegalArgumentException - if the any of the reference arguments are null or the aspect ratio is less than or equal to zero.
      • positionImage

        public static Sector positionImage​(java.awt.image.BufferedImage sourceImage,
                                           java.awt.Point[] imagePoints,
                                           LatLon[] geoPoints,
                                           java.awt.image.BufferedImage destImage)
      • positionImage3

        public static Sector positionImage3​(java.awt.image.BufferedImage sourceImage,
                                            java.awt.Point[] imagePoints,
                                            LatLon[] geoPoints,
                                            java.awt.image.BufferedImage destImage)
      • positionImage4

        public static Sector positionImage4​(java.awt.image.BufferedImage sourceImage,
                                            java.awt.Point[] imagePoints,
                                            LatLon[] geoPoints,
                                            java.awt.image.BufferedImage destImage)
      • buildMipmaps

        public static java.awt.image.BufferedImage[] buildMipmaps​(java.awt.image.BufferedImage image,
                                                                  int mipmapImageType,
                                                                  int maxLevel)
        Builds a sequence of mipmaps for the specified image. The number of mipmap levels created will be equal to maxLevel + 1, including level 0. The level 0 image will be a reference to the original image, not a copy. Each mipmap level will be created with the specified BufferedImage type mipmapImageType. Each level will have dimensions equal to 1/2 the previous level's dimensions, rounding down, to a minimum width or height of 1.
        Parameters:
        image - the BufferedImage to build mipmaps for.
        mipmapImageType - the BufferedImage type to use when creating each mipmap image.
        maxLevel - the maximum mip level to create. Specifying zero will return an array containing the original image.
        Returns:
        array of mipmap levels, starting at level 0 and stopping at maxLevel. This array will have length maxLevel + 1.
        Throws:
        java.lang.IllegalArgumentException - if image is null, or if maxLevel is less than zero.
        See Also:
        getMaxMipmapLevel(int, int)
      • buildMipmaps

        public static java.awt.image.BufferedImage[] buildMipmaps​(java.awt.image.BufferedImage image)
        Builds a sequence of mipmaps for the specified image. This is equivalent to invoking buildMipmaps(BufferedImage, int, int), with mipmapImageType equal to getMipmapType(image.getType()), and maxLevel equal to getMaxMipmapLevel(image.getWidth(), image.getHeight()).
        Parameters:
        image - the BufferedImage to build mipmaps for.
        Returns:
        array of mipmap levels.
        Throws:
        java.lang.IllegalArgumentException - if image is null.
      • getMipmapType

        public static int getMipmapType​(int imageType)
        Returns an image type appropriate for generating mipmaps.
        Parameters:
        imageType - the original BufferedImage type.
        Returns:
        mipmap image type.
      • getMaxMipmapLevel

        public static int getMaxMipmapLevel​(int width,
                                            int height)
        Returns the maximum desired mip level for an image with dimensions width and height. The maximum desired level is the number of levels required to reduce the original image dimensions to a 1x1 image.
        Parameters:
        width - the level 0 image width.
        height - the level 0 image height.
        Returns:
        maximum mip level for the specified width and height.
        Throws:
        java.lang.IllegalArgumentException - if either width or height are less than 1.
      • convertToPowerOfTwoImage

        public static java.awt.image.BufferedImage convertToPowerOfTwoImage​(java.awt.image.BufferedImage image,
                                                                            boolean scaleToFit)
        Returns a copy of the specified image such that the new dimensions are powers of two. The new image dimensions will be equal to or greater than the original image. The flag scaleToFit determines whether the original image should be drawn into the new image with no special scaling, or whether the original image should be scaled to fit exactly in the new image.

        If the original image dimensions are already powers of two, this method will simply return the original image.

        Parameters:
        image - the BufferedImage to convert to a power of two image.
        scaleToFit - true if image should be scaled to fit the new image dimensions; false otherwise.s
        Returns:
        copy of image with power of two dimensions.
        Throws:
        java.lang.IllegalArgumentException - if image is null.
      • trimImage

        public static java.awt.image.BufferedImage trimImage​(java.awt.image.BufferedImage image)
        Returns a copy of the specified image with any fully-transparent borders removed. The resultant image is cropped to fit its contents.
        Parameters:
        image - the BufferedImage to trim.
        Returns:
        copy of image with its transparent borders trimmed
        Throws:
        java.lang.IllegalArgumentException - if image is null.
      • computeSizeInBytes

        public static long computeSizeInBytes​(java.awt.image.BufferedImage image)
        Returns the size in bytes of the specified image. This takes into account only the image's backing DataBuffers, and not the numerous supporting classes a BufferedImage references.
        Parameters:
        image - the BufferedImage to compute the size of.
        Returns:
        size of the BufferedImage in bytes.
        Throws:
        java.lang.IllegalArgumentException - if image is null.
      • openSpatialImage

        public static AVList openSpatialImage​(java.io.File imageFile,
                                              int interpolation_mode)
                                       throws java.io.IOException
        Opens a spatial image. Reprojects the image if it is in UTM projection.
        Parameters:
        imageFile - source image
        interpolation_mode - the interpolation mode if the image is reprojected.
        Returns:
        AVList
        Throws:
        java.io.IOException - if there is a problem opening the file.
        WWRuntimeException - if the image type is unsupported.
      • openSpatialImage

        public static AVList openSpatialImage​(java.io.File imageFile)
                                       throws java.io.IOException
        Opens a spatial image. Reprojects the image if it is in UTM projection.
        Parameters:
        imageFile - source image
        Returns:
        AVList
        Throws:
        java.io.IOException - if there is a problem opening the file.
      • readGeoKeys

        public static AVList readGeoKeys​(gov.nasa.worldwind.formats.tiff.GeotiffReader reader,
                                         int imageIndex,
                                         AVList values)
                                  throws java.io.IOException
        Reads Geo-referenced metadata from Geo-TIFF file
        Parameters:
        reader - GeotiffReader
        imageIndex - image index (could be a band; GeoTiff file could contain overview images, bands, etc)
        values - AVList
        Returns:
        values AVList
        Throws:
        java.io.IOException - if there is a problem opening the file.
      • calcBoundingBoxForUTM

        public static Sector calcBoundingBoxForUTM​(AVList params)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • reprojectUtmToGeographic

        public static void reprojectUtmToGeographic​(AVList values,
                                                    int mode)
        Reprojects an imge in UTM projection to Geo/WGS84.
        Parameters:
        values - AVList: contains the bufferedimage and the values from the world file. Stores resulting image in values
        mode - the interpolation mode if the image is reprojected.
      • interpolateColor

        public static int interpolateColor​(double x,
                                           double y,
                                           int c0,
                                           int c1,
                                           int c2,
                                           int c3)
        Performs bilinear interpolation of 32-bit colors over a convex quadrilateral.
        Parameters:
        x - horizontal coordinate of the interpolation point relative to the lower left corner of the quadrilateral. The value should generally be in the range [0, 1].
        y - vertical coordinate of the interpolation point relative to the lower left corner of the quadrilateral. The value should generally be in the range [0, 1].
        c0 - color at the lower left corner of the quadrilateral.
        c1 - color at the lower right corner of the quadrilateral.
        c2 - color at the pixel upper left corner of the quadrilateral.
        c3 - color at the pixel upper right corner of the quadrilateral.
        Returns:
        int the interpolated color.
      • alignImage

        public static ImageUtil.AlignedImage alignImage​(java.awt.image.BufferedImage sourceImage,
                                                        float[] latitudes,
                                                        float[] longitudes)
                                                 throws java.lang.InterruptedException
        Reprojects an image into an aligned image, one with edges of constant latitude and longitude.
        Parameters:
        sourceImage - the image to reproject, typically a non-aligned image
        latitudes - an array identifying the latitude of each pixels if the source image. There must be an entry in the array for all pixels. The values are taken to be in row-major order relative to the image -- the horizontal component varies fastest.
        longitudes - an array identifying the longitude of each pixels if the source image. There must be an entry in the array for all pixels. The values are taken to be in row-major order relative to the image -- the horizontal component varies fastest.
        Returns:
        a new image containing the original image but reprojected to align to the bounding sector. Pixels in the new image that have no correspondence with the source image are transparent.
        Throws:
        java.lang.InterruptedException - if any thread has interrupted the current thread while alignImage is running. The interrupted status of the current thread is cleared when this exception is thrown.
      • alignImage

        public static ImageUtil.AlignedImage alignImage​(java.awt.image.BufferedImage sourceImage,
                                                        float[] latitudes,
                                                        float[] longitudes,
                                                        Sector sector,
                                                        java.awt.Dimension dimension)
                                                 throws java.lang.InterruptedException
        Reprojects an image into an aligned image, one with edges of constant latitude and longitude.
        Parameters:
        sourceImage - the image to reproject, typically a non-aligned image
        latitudes - an array identifying the latitude of each pixels if the source image. There must be an entry in the array for all pixels. The values are taken to be in row-major order relative to the image -- the horizontal component varies fastest.
        longitudes - an array identifying the longitude of each pixels if the source image. There must be an entry in the array for all pixels. The values are taken to be in row-major order relative to the image -- the horizontal component varies fastest.
        sector - the sector to align the image to. If null, this computes the aligned image's sector.
        dimension - the the aligned image's dimensions. If null, this computes the aligned image's dimension.
        Returns:
        a new image containing the original image but reprojected to align to the sector. Pixels in the new image that have no correspondence with the source image are transparent.
        Throws:
        java.lang.InterruptedException - if any thread has interrupted the current thread while alignImage is running. The interrupted status of the current thread is cleared when this exception is thrown.
      • alignImageDump

        public static void alignImageDump​(java.awt.image.BufferedImage sourceImage,
                                          float[] latitudes,
                                          float[] longitudes)
      • toCompatibleImage

        public static java.awt.image.BufferedImage toCompatibleImage​(java.awt.image.BufferedImage image)
      • createCompatibleImage

        public static java.awt.image.BufferedImage createCompatibleImage​(int width,
                                                                         int height,
                                                                         int transparency)
      • isCompatibleImage

        protected static boolean isCompatibleImage​(java.awt.image.BufferedImage image)
      • getDefaultGraphicsConfiguration

        protected static java.awt.GraphicsConfiguration getDefaultGraphicsConfiguration()
      • mapTransparencyColors

        public static java.awt.image.BufferedImage mapTransparencyColors​(java.nio.ByteBuffer imageBuffer,
                                                                         int[] originalColors)
      • mapTransparencyColors

        public static java.awt.image.BufferedImage mapTransparencyColors​(java.awt.image.BufferedImage sourceImage,
                                                                         int[] originalColors)
      • mapColors

        public static java.awt.image.BufferedImage mapColors​(java.nio.ByteBuffer imageBuffer,
                                                             int originalColor,
                                                             int newColor)
      • mapColors

        public static java.awt.image.BufferedImage mapColors​(java.awt.image.BufferedImage sourceImage,
                                                             int[] originalColors,
                                                             int[] newColors)
      • asJPEG

        public static java.nio.ByteBuffer asJPEG​(DataRaster raster)
      • asPNG

        public static java.nio.ByteBuffer asPNG​(DataRaster raster)
      • close

        protected static void close​(javax.imageio.stream.ImageOutputStream ios)
      • visualize

        public static java.awt.image.BufferedImage visualize​(BufferWrapperRaster raster)
        Converts a non-imagery data raster (elevations) to visually representable image raster. Calculates min and max values, and normalizes pixel value from 0 - 65,535 and creates a GRAY color image raster with pixel data type of unsigned short.
        Parameters:
        raster - non-imagery data raster (elevations) instance of data raster derived from BufferWrapperRaster
        Returns:
        BufferedImage visual representation of the non-imagery data raster