JSPM

ndarray-lanczos

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19812
  • Score
    100M100P100Q162166F
  • License MIT

Resize an ndarray with Lanczos resampling

Package Exports

  • ndarray-lanczos

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ndarray-lanczos) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ndarray-lanczos

Latest NPM release License Minzipped size CI

Resize an ndarray with Lanczos resampling.

Quickstart

Installation:

npm install --save ndarray-lanczos

Use:

import ndarray from 'ndarray';
import { getPixels, savePixels } from 'ndarray-pixels';
import { lanczos3 } from 'ndarray-lanczos';

// Read PNG.
const srcPixels = await getPixels('full-size.png');

// Resize with Lanczos 3 resampling.
const dstPixels = ndarray(new Uint8Array(width * height * 4).fill(0), [width, height, 4]);
lanczos3(srcPixels, dstPixels);

// Write PNG.
const data = await savePixels(dstPixels, 'image/png'); // → Uint8Array

Two filtering methods, lanczos3 and lanczos2, are included. If the image is rotated differently than expected, try pixels.transpose(1, 0).

Credits

Thanks to https://github.com/rgba-image/lanczos and https://github.com/nodeca/pica.