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 🙏

© 2025 – Pkg Stats / Ryan Hefner

tinys

v1.0.3

Published

A tool to compress images with tinify API

Readme

tinys

tinys is an command tool to compress and resize local images or web images with tinify APIs. You can get compressed images with size that you want.

Before you use it to compress images, a tinify key is needed. You can get the developer API key from TinyPNG. It's free with 500 times per month.

Install

$ npm install tinys -g

How to use

You can get help

$ tinys -h

Key

key is needed to use tinify APIs to compress or resize images.So set key firstly

$ tinys config -k <your API key>

Then you can check your key

$ tinys config -l

Proxy

You can set your proxy with command

$ tinys config -p <proxyUrl>

Compress

After set the API key, you can start to compress image

$ tinys [fromPath] [toPath]

fromPath can be file or directory, toPath must be directory when the fromPath is directory.If you do not set toPath, it will create a new directory named 'tiny' and compress images to it.

(1) Compress local image

$ tinys ./tiny.png 

Then tiny.png will be save to a new directory ./tiny.So it's path is ./tiny/tiny.png.

Also you can set the image name:

// the compress image will be test.png
$ tinys ./tiny.png test.png
// new directory tiny will be created
$ tinys ./tiny.png ./tiny/test.png

(2) Compress local directory images

In order to make it easy to compress many images.You can compress all images in a directory to another directory:

// all images in tiny will be compressed to compress directory
$ tinys ./tiny ./compress

(3) Download and compress web images

You can download web images and compress them with:

$ tinys url <imgUrl> <imgUrl> <imgUrl> ...

All images will be compressed to a directory ./tiny.Of course, you can set a directory to store these images, it will be store in the global config:

$ tinys config -d <compressDir>

Resize

You can resize image according to set resize type, image width, image height config.There are four resize methods:

scale

Scale the picture down. You must provide the target width or height, not both. The reduced image will have a certain width or height.

$ tinys url -m scale -w 1000 <url> <url> 

$ tinys <fromPath> <toPath> -m scale -w 1000
fit

Scale the picture to fit the given size. You have to provide both width and height. The reduced image will not exceed any of these sizes.

$ tinys url -m fit -w 1000 -h 1000 <url> <url>

$ tinys <fromPath> <toPath> -m fit -w 1000 -h 1000
cover

Reduce the size of the picture to scale and cut the image if necessary. You have to provide both width and height.

$ tinys url -m cover -w 1000 -h 1000 <url> <url>

$ tinys <fromPath> <toPath> -m cover -w 1000 -h 1000

The results have accurate given size. Which part of the picture will be cut is automatically determined. The intelligent algorithm determines the most important region in the image.

thumb

A more advanced implementation of the thumbnail, but also can detect the simple background of the cut image. You have to provide both width and height.

$ tinys url -m thumb -w 1000 -h 1000 <url> <url> 

$ tinys <fromPath> <toPath> -m thumb -w 1000 -h 1000

The image will be reduced to the size of the width and height you provide. If an image is detected as an independent object, the algorithm will add more background in the necessary position, or cut out the unimportant parts.

see more detail and examples on https://tinify.cn/developers/reference/nodejs.

Config

You can set resize config like key then you do not need to input many param every time.

$ tinys config -m <resizeType>

$ tinys config -w <resizeWidth>

$ tinys config -h <resizeHeight>

You can check all configs:

$ tinys config -l

You can clear all configs:

$ tinys config -c

You can delete one config param:

$ tinys config -D <param>