Eozin JS SDK v0.1.0-alpha.2
    Preparing search index...

    Class Tile

    Contains the encoded tile byte sequence, dimensions, and image format information.

    This struct implements Deref<Target = [u8]> and AsRef<[u8]>, allowing it to be used directly as an encoded byte slice.

    # #[cfg(feature= "std-io")]
    # {
    # use eozin::{std_io::DynamicDecoder, Tile};
    # let mut decoder = DynamicDecoder::with_path("/some/slide.svs").unwrap();
    let tile: Tile = decoder.read_tile(0, 0, 0).unwrap();
    std::fs::write("output.jpg", &tile).unwrap();
    # }
    

    Indexable

    • [key: number]: () => void
    Index

    Properties

    height: number

    Height of the tile.

    mimeType: string

    Returns the MIME type of the encoded tile image.

    width: number

    Width of the tile.

    Methods

    • Returns void

    • Returns the tile as a Blob.

      Formats not natively supported by browsers (such as TIFF or JPEG 2000) are automatically converted to PNG.

      Note: The Tile::mime_type() method returns the original image format, which may differ from the MIME type of the Blob returned here.

      This method requires the wasm-web feature.

      # #[cfg(feature= "wasm-web")]
      # {
      # use eozin::wasm::web::DynamicDecoder;
      # use web_sys::Blob;
      # async fn main() {
      # let decoder = DynamicDecoder::with_blob(Blob::new().unwrap()).await.unwrap();
      # let tile = decoder.read_tile(0, 0, 0).await.unwrap();
      assert!(tile.is_jpeg2000());
      let blob = tile.to_blob().unwrap();
      assert_eq!(&blob.type_(), "image/png");
      # }
      # }
      

      Returns Blob

    • Returns the raw encoded tile buffer as a Uint8Array. No format conversion is performed.

      This method requires the wasm-node or wasm-web feature.

      Returns Uint8Array