JSPM

squarifier

1.1.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q0F
  • License ISC

Transforms images in a directory to perfect squares

Package Exports

  • squarifier

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 (squarifier) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

GitHub license npm package npm package Build Status

squarifier

Description

Transforms images in a directory to perfect squares.

Installation

npm i squarifier

Usage

If you want to squarify all of the images in a given directory with a max size of 1200 pixels and fill the margin with a black background color, you can do the following:

Solution 1: code example

let squarifier = require('squarifier');

squarifier('path/to/img/folder', 1200, 0x000000FF)
  .catch(err => {
    console.log(err);
  }).then((counter) => {
    console.log(`Done. Changed ${counter} files.`);
  });

Solution 2: CLI

node path/to/squarifier/index.js -d path/to/img/folder -s 1200 -c 0x000000FF

For more examples, see examples.

CLI options

-d, --directory [path] target directory (required)

-s --size [integer] output canvas size (default is 1000)

-c --color [0xrrggbbaa] background color (default is 0xffffffff)

-h, --help output usage information

Supported image formats

  • bmp
  • gif
  • jpeg
  • png
  • tiff

Other formats will be ignored.

Requirements

  • Node version 7.6.0 and above

Author

  • Christoffer Ekblom