loci.formats.services

## Interface JPEGTurboService

- All Superinterfaces:
    loci.common.services.Service
  All Known Implementing Classes:
    JPEGTurboServiceImpl

      public interface JPEGTurboService
      extends loci.common.services.Service

  Author:
    Melissa Linkert

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Free resources associated with the initialized stream.
    `byte[]` | `getCompressedTile(byte[] data, int xTile, int yTile)` Similar to getTile(int, int), but returns the JPEG-compressed bytes.
    `byte[]` | `getCompressedTile(int xTile, int yTile)` Similar to getTile(int, int), but returns the JPEG-compressed bytes.
    `long[]` | `getRestartMarkers()`
    `byte[]` | `getTile(byte[] buf, int xCoordinate, int yCoordinate, int width, int height)` Get the uncompressed bytes representing the given bounding box.
    `byte[]` | `getTile(int xTile, int yTile)` Get the uncompressed bytes representing the given tile index.
    `int` | `getTileColumns()`
    `int` | `getTileHeight()`
    `int` | `getTileRows()`
    `int` | `getTileWidth()`
    `void` | `initialize(loci.common.RandomAccessInputStream jpeg, int width, int height)` Initialize the given stream, which represents an image of the given width and height.
    `boolean` | `isLibraryLoaded()`
    `void` | `setRestartMarkers(long[] markers)`

- - ### Method Detail

    - #### getRestartMarkers

          long[] getRestartMarkers()

      Returns:
        the restart markers associated with the current JPEG stream

    - #### setRestartMarkers

          void setRestartMarkers(long[] markers)

      Parameters:
        `markers` - precalculated restart markers associated with the current JPEG stream

    - #### initialize

          void initialize(loci.common.RandomAccessInputStream jpeg,
                          int width,
                          int height)
                   throws loci.common.services.ServiceException,
                          java.io.IOException

      Initialize the given stream, which represents an image of the given width and height. This service is primarily intended for very large JPEG images whose width and/or height exceed 65535 (the maximum that can be recorded in a JPEG stream).
      Parameters:
        `jpeg` - open stream containing JPEG data
        `width` - total image width
        `height` - total image height
      Throws:
        `loci.common.services.ServiceException`
        `java.io.IOException`

    - #### getTileWidth

          int getTileWidth()

      Returns:
        the width (in pixels) of a tile

    - #### getTileHeight

          int getTileHeight()

      Returns:
        the height (in pixels) of a tile

    - #### getTileRows

          int getTileRows()

      Returns:
        the number of rows of tiles

    - #### getTileColumns

          int getTileColumns()

      Returns:
        the number of columns of tiles

    - #### getTile

          byte[] getTile(byte[] buf,
                         int xCoordinate,
                         int yCoordinate,
                         int width,
                         int height)
                  throws java.io.IOException

      Get the uncompressed bytes representing the given bounding box.
      Parameters:
        `buf` - array in which to store uncompressed bytes
        `xCoordinate` - upper-left X coordinate of bounding box
        `yCoordinate` - upper-left Y coordinate of bounding box
        `width` - width of bounding box
        `height` - height of bounding box
      Returns:
        uncompressed bytes
      Throws:
        `java.io.IOException`

    - #### getTile

          byte[] getTile(int xTile,
                         int yTile)
                  throws java.io.IOException

      Get the uncompressed bytes representing the given tile index.
      Parameters:
        `xTile` - column index of the tile
        `yTile` - row index of the tile
      Returns:
        uncompressed bytes
      Throws:
        `java.io.IOException`

    - #### getCompressedTile

          byte[] getCompressedTile(int xTile,
                                   int yTile)
                            throws java.io.IOException

      Similar to getTile(int, int), but returns the JPEG-compressed bytes.
      Parameters:
        `xTile` - column index of the tile
        `yTile` - row index of the tile
      Returns:
        JPEG-compressed bytes
      Throws:
        `java.io.IOException`

    - #### getCompressedTile

          byte[] getCompressedTile(byte[] data,
                                   int xTile,
                                   int yTile)
                            throws java.io.IOException

      Similar to getTile(int, int), but returns the JPEG-compressed bytes.
      Parameters:
        `data` - preallocated array for storing tile
        `xTile` - column index of the tile
        `yTile` - row index of the tile
      Returns:
        JPEG-compressed bytes
      Throws:
        `java.io.IOException`

    - #### close

          void close()
              throws java.io.IOException

      Free resources associated with the initialized stream.
      Throws:
        `java.io.IOException`

    - #### isLibraryLoaded

          boolean isLibraryLoaded()

      Returns:
        true if the underlying native library was successfully loaded

Copyright © 2026 Open Microscopy Environment