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

imageresizer

v1.0.0

Published

A command line tool to easily resize a bunch of images to a bunch of different sizes.

Downloads

5

Readme

imageresizer

A command line tool to easily resize a bunch of images to a bunch of different sizes.

Getting Started

The tool uses the gm library, which itself requires the installation of ImageMagick or GraphicsMagick. See their instructions for getting started on the gm library page for more info.

After that, you can install the tool by simply running npm install image-batch-resizer

You can run it using the command line like this:

imageresizer --input imagesdir1 --input single.jpg --output outputdir --size 200x200 --size 300x300 --size 250x200

This example reads in the files in directory imagesdir1 and additionally the file single.jpg. It resizes the input images to the sizes 200x200, 300x300, 250x200 (width x height). It will save the resized files in the outputdir, and produces the following output (assuming the imagesdir1 contains the files folderfile1.jpg and folderfile2.jpg):

  • outputdir/folderfile1/original.jpg
  • outputdir/folderfile1/200x200.jpg
  • outputdir/folderfile1/300x300.jpg
  • outputdir/folderfile1/250x200.jpg
  • outputdir/folderfile2/original.jpg
  • outputdir/folderfile2/200x200.jpg
  • outputdir/folderfile2/300x300.jpg
  • outputdir/folderfile2/250x200.jpg
  • outputdir/single/original.jpg
  • outputdir/single/200x200.jpg
  • outputdir/single/300x300.jpg
  • outputdir/single/250x200.jpg

Documentation

The following command line parameters can be used:

  • -i or --input (required): Use it to give the tool the image files you want to be resized. You can use -i multiple times to give it multiple inputs, where the input value can be either a file or a directory.
  • -o or --output (required): Tell the tool where to store the output files. It will create a separate directory in the output folder for every resized image. All input images will be copied named original. The resized files will be named according to their size. Example: Input=example.jpg => Output= output/example/original.jpg und output/example/200x200.jpg
  • -s or --size (required): Use it to define different target sizes in the format XxY, e.g., 200x300 or 250x200. You can use it multiple times for all needed target sizes.
  • -c or --clearOutput (optional): Use this parameter (just name it, no need for a value) to clear the output directory before copying over the resized images. It just runs a rm -rf on the output directory. If you don't set the flag, we will use the output directory as is, but we won't override any file.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Any contribution is welcome, for example:

  • Send us Feature Requests or Bug reports or any questions in the Issues section
  • Send a Pull Request for an existing Issue and become author of the tool
  • Just write an email (or whatever you prefer) and give us some feedback

License

Copyright (c) 2013 Alexander Kohout
Licensed under the MIT license.