org.apache.xmlgraphics.image.loader.spi

## Interface ImageLoader

- All Known Implementing Classes:
    AbstractImageLoader, CompositeImageLoader, ImageLoaderEPS, ImageLoaderImageIO, ImageLoaderInternalTIFF, ImageLoaderPNG, ImageLoaderRaw, ImageLoaderRawCCITTFax, ImageLoaderRawJPEG, ImageLoaderRawPNG

      public interface ImageLoader

  This interface is implemented by classes which load images from a source. Normally, such a source will be an InputStream but can also be something else.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `MEDIUM_LOADING_PENALTY` Default/Medium conversion penalty (if there's some effort to load the image format)
    `static int` | `NO_LOADING_PENALTY` Used if the loading penalty is negligible (image doesn't need to be decoded).

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `ImageFlavor` | `getTargetFlavor()` Returns the image flavor that is returned by this ImageLoader implementation.
    `int` | `getUsagePenalty()` Returns the penalty assigned to using this image loader.
    `Image` | `loadImage(ImageInfo info, ImageSessionContext session)` Loads and returns an image.
    `Image` | `loadImage(ImageInfo info, java.util.Map<java.lang.String,java.lang.Object> hints, ImageSessionContext session)` Loads and returns an image.

- - ### Field Detail

    - #### NO_LOADING_PENALTY

          static final int NO_LOADING_PENALTY

      Used if the loading penalty is negligible (image doesn't need to be decoded).
      See Also:
        Constant Field Values

    - #### MEDIUM_LOADING_PENALTY

          static final int MEDIUM_LOADING_PENALTY

      Default/Medium conversion penalty (if there's some effort to load the image format)
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### loadImage

          Image loadImage(ImageInfo info,
                          java.util.Map<java.lang.String,java.lang.Object> hints,
                          ImageSessionContext session)
                   throws ImageException,
                          java.io.IOException

      Loads and returns an image.
      Parameters:
        `info` - the image info object indicating the image
        `hints` - a Map of hints that can be used by implementations to customize the loading process (may be null).
        `session` - the session context
      Returns:
        the fully loaded image
      Throws:
        `ImageException` - if an error occurs while loading the image
        `java.io.IOException` - if an I/O error occurs while loading the image

    - #### loadImage

          Image loadImage(ImageInfo info,
                          ImageSessionContext session)
                   throws ImageException,
                          java.io.IOException

      Loads and returns an image.
      Parameters:
        `info` - the image info object indicating the image
        `session` - the session context
      Returns:
        the fully loaded image
      Throws:
        `ImageException` - if an error occurs while loading the image
        `java.io.IOException` - if an I/O error occurs while loading the image

    - #### getTargetFlavor

          ImageFlavor getTargetFlavor()

      Returns the image flavor that is returned by this ImageLoader implementation.
      Returns:
        the target image flavor

    - #### getUsagePenalty

          int getUsagePenalty()

      Returns the penalty assigned to using this image loader. The value is used to select the best processing chain for images.
      Returns:
        the usage penalty (must be a non-negative integer)

Copyright 1999-2025 The Apache Software Foundation. All Rights Reserved.