npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

image-tiler

v2.0.3

Published

Create zoom tile pyramids from a large image

Downloads

34

Readme

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.