UNPKG

gis-tools-ts

Version:

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

42 lines 1.93 kB
/** * # Lanczos Resampling * * ## Description * 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. * * ## Usage * ```ts * 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); * ``` * * ## Links * - https://en.wikipedia.org/wiki/Lanczos_algorithm * - https://en.wikipedia.org/wiki/Lanczos_resampling * - https://gis.stackexchange.com/questions/10931/what-is-lanczos-resampling-useful-for-in-a-spatial-context * - https://icess.eri.ucsb.edu/gem/Duchon_1979_JAM_Lanczos.pdf * @param source - the source image * @param dest - the destination image * @param sx - source starting x point [Default: 0] * @param sy - source starting y point [Default: 0] * @param sw - source width to use [Default: source width - sx] * @param sh - source height to use [Default: source height - sy] * @param dx - destination starting x point [Default: 0] * @param dy - destination starting y point [Default: 0] * @param dw - destination width to use [Default: destination width - dx] * @param dh - destination height to use [Default: destination height - dy] * @param use2 - use 2nd lanczos filter instead of 3rd [Default: false] */ export declare function lanczos(source: ImageData, dest: ImageData, sx?: number, sy?: number, sw?: number, sh?: number, dx?: number, dy?: number, dw?: number, dh?: number, use2?: boolean): void; //# sourceMappingURL=lanczos.d.ts.map