gis-tools-ts - v0.6.0
    Preparing search index...

    Function lanczos

    • Lanczos Resampling

      Perform a 2D Lanczos filter on an image. the Lanczos resampler creates some regions that are darker than any in the original and others that are lighter than any in the original. This Fourier transform method is useful in spatial/GIS applications, especially downscaling raster data.

      import sharp from 'sharp';
      import { lanczos, createImage } from 'gis-tools-ts';
      // pull in the image you want to downscale
      const pattern = await sharp('./pattern.png')
      .raw()
      .toBuffer({ resolveWithObject: true });
      // setup the destianation image
      const patternHalf = createImage(4, 4);
      // resize down into patternHalf
      lanczos(pattern, patternHalf);

      Parameters

      • source: ImageData

        the source image

      • dest: ImageData

        the destination image

      • sx: number = 0

        source starting x point [Default: 0]

      • sy: number = 0

        source starting y point [Default: 0]

      • sw: number = ...

        source width to use [Default: source width - sx]

      • sh: number = ...

        source height to use [Default: source height - sy]

      • dx: number = 0

        destination starting x point [Default: 0]

      • dy: number = 0

        destination starting y point [Default: 0]

      • dw: number = ...

        destination width to use [Default: destination width - dx]

      • dh: number = ...

        destination height to use [Default: destination height - dy]

      • use2: boolean = false

        use 2nd lanczos filter instead of 3rd [Default: false]

      Returns void