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

img-slice

v2.0.0

Published

A simple image slicer, into row/column tiles.

Downloads

11

Readme

Hi Christopher, I'm Nero.

This utility takes as input a tiled image file (any image format compatible with node-canvas), and outputs the individual tiles as image files. Don't tell me it didn't happen, I saw it happen!

(The next version will also allow you to stitch tiles together.)

Usage:

npm install (if you haven't already, or if you want to download from npm:)

npm install g img-slice

node img-slice [input_img_fileName] [cols/x] [rows/y] [jpeg/png/etc] [fileName_formatStr] [scale] [filePath] [toDataURL]

There are up to 7 arguments that can be passed to img-slice. They are as follows:

[input_img_fileName] ; The name of the image file to slice into tiles. [cols/x] ; The number of columns to split the input image into. [rows/y] ; The number of rows to split the input image into.

Optional::

(Use null, undefined, 0, or false for any mid-sequence args you want to skip. Yes, I know all those values are passed as strings, it's syntactic sugar! Don't wrap them in quotes...)

[jpeg/png/etc] ; The "node-canvas"-compatible image format for the output files. ; Note: There is a bug in Node-Canvas. Specify "jpeg", not "jpg". [fileName_formatStr] ; Optional formatting string for output filenames, sans file extension. ; Example might be: {c}BY{r} ; This would produce filenames '1BY2.jpeg' for the tile that is ; column 1, row 2, if the image format selected is 'jpeg'. ; (Do not surround in quotes, unless you want spaces in the filename, ; as otherwise the utility strips containing-quotes from the output ; filenames. I suppose you could double-up the quote delimiters...) [scale] ; If set to 0, the output tiles are each the same size as the input ; image. Otherwise, each tile-image is scaled according to their ; original size as a tile in the larger input Image. In other words, if you ; specifiy a scale of 1, the output tiles will be their own original ; dimensions. [filePath] ; If you want to target another directory aside from the working ; directory, specify a file path here. I do NOT recommend starting ; the path with ./ certainly not in a Windows command box. [toDataURL] ; You can if you wish, output the tiles as DataURL strings, in which ; case the output files will have ext ".txt". ; Options: 1, true, 1:q, true:q (or even 0, false, etc) ; 1:q & true:q will wrap the dataURL string in enclosing double-quotes, for ; ease-of-use, saves you the potentially mundane hassle of doing it.

Output: (cols x rows) image files representing the individual tiles (Or the same number of .txt files containing DataURL strings.)

(C) Inventor Dave, Beyond Time & Space, so no commitment on that point.