Class ImageLoader


  • public class ImageLoader
    extends java.lang.Object
    Loads image files such as PNG, JPEG, GIF, TIFF and BMP.

    TODO: The goal of this class is to use Java ImageIO to parse images and metadata, and embed the image in the PDF in the best way (the compressed image format, not the raw pixels).

    We don't want to maintain our own image codecs.

    • Constructor Detail

      • ImageLoader

        public ImageLoader()
    • Method Detail

      • getPngImage

        public static Image getPngImage​(java.net.URL url)
        Creates an Image from a PNG image file in an URL.
        Parameters:
        url - url of the image
        Returns:
        an object of type Image
      • getGifImage

        public static Image getGifImage​(java.net.URL url)
      • getTiffImage

        public static Image getTiffImage​(java.net.URL url)
      • getBmpImage

        public static Image getBmpImage​(java.net.URL url)
      • getJpegImage

        public static Image getJpegImage​(java.net.URL url)
        Creates an Image from a JPEG image file in an URL.
        Parameters:
        url - url of the image
        Returns:
        an object of type Image
      • getJpeg2000Image

        public static Image getJpeg2000Image​(java.net.URL url)
      • getGifImage

        public static Image getGifImage​(byte[] imageData)
      • getPngImage

        public static Image getPngImage​(byte[] imageData)
      • getBmpImage

        public static Image getBmpImage​(byte[] imageData)
      • getTiffImage

        public static Image getTiffImage​(byte[] imageData)
        Creates an Image from an array of tiff image bytes.
        Parameters:
        imageData - bytes of the tiff image
        Returns:
        an objet of type Image
      • getJpegImage

        public static Image getJpegImage​(byte[] imageData)
        Creates an Image from a JPEG image file in a byte array.
        Parameters:
        imageData - bytes of the image
        Returns:
        an object of type Image
      • getJpeg2000Image

        public static Image getJpeg2000Image​(byte[] imageData)