New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

image-tiler

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

image-tiler

Create zoom tile pyramids from a large image

latest
Source
npmnpm
Version
2.0.3
Version published
Maintainers
1
Created
Source

image-tiler

Create zoom tile pyramids from a large image. There are other packages very similar to this one, but none did exactly what I needed, so I made mine.

Installation

You need imagemagick installed. In ubuntu, you can install it like this:

sudo apt-get update
sudo apt-get install imagemagick

Then

npm install image-tiler --save

Usage

Include it like this:

var tile = require('image-tiler').tile;

For example:

//index.js
var tile = require('image-tiler').tile;

var tilePromise = tile('input/image.png', 'output/folder/', 'save_pattern_{z}/tile_{x}_{z}.png');
tilePromise.then(() => console.log('Finished.'))
.catch((error) => console.log('Error', error));
// Output tiles will look like: output/folder/save_pattern_0/tile_0_0.png etc.

Parameters

The tile function accepts the following parameters:

tile(inPath, outPath, pattern, [options]);

inPath is the path and filename of the large image you want to slice. The format will be deduced from the filename, and it accepts any format that ImageMagick accepts. .jpeg, .png, etc.

outPath is a path to a directory where the output tiles will be saved.

pattern describes the structure and file names of the tile files. {z}, {x}, {y} will be replaced with the file's values. The extension of the pattern will determine the image format. Supported formats are any supported by ImageMagick. .jpeg, .png, etc. You can have directories or not, but only for the zoom level. E.g. zoom-{z}/tile-{y}_{x}.png is OK, but {z}/{x}/{y}.png is not.

options is an optional object with the following optional properties:

options.tmpDir a path to the directory where tile will write intermediate files. Defaults to process.env.TMPDIR (usually /tmp) or /tmp

options.tileSize defaults to 256

options.quality defaults to 100

options.invertZoom false by default. If true, zoom levels will go from 0 (original image scale) to N (one tile, all zoomed out). Which is the opposite of the default behavior.

Keywords

tile

FAQs

Package last updated on 05 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts