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

ensharp

v1.0.0

Published

A cli app for image manipulation

Downloads

4

Readme

ensharp

Ensharp is a command line tool that can be used to convert images in common formats to other formats of varying dimensions.

Installation

You need node.js and npm. It's Recommended you install the package globally

$ npm install --global ensharp

Manual Installation

git clone https://github.com/Somtozech/ensharp.git
cd ensharp
npm install # Local dependencies if you want to hack
npm install -g # Install globally

Usage

ensharp [options] [command]

Options:
  -V, --version             output the version number
  -h, --help                display help for command

Commands:
  convert <input> <output>  Convert an image from one format to another.
  resize [options] <input>  Resize image to a particular width or height or width x height
  help [command]            display help for command

Convert

ensharp help convert 

Usage: ensharp convert [options] <input> <output>

Convert an image from one format to another.

Options:
  -h, --help  display help for command

Resize

ensharp help resize

Usage: ensharp resize [options] <input>

Resize image to a particular width or height or width x height

Options:
  -w, --width <number>       width of the resulting image in pixel
  -h, --height <number>      height of the resulting image in pixel
  --sizes <widthxheight>     Specify multiple sizes for resizing eg `720x360,480x360,1080x720`
  --fit <type>               how resulting image should fit provided dimension. one of `cover, fill, contain, inside, outside`
  -pos,--position <type>     Position of image when fit is `cover` or `contain` (default is center). one of `top,right top,
                             right,right bottom,bottom,left bottom,left,left top, center`
  -bg, --background <color>  Background color when fit is `cover` or `contain`. Accepts hex color codes, RGB and HSL values
  --help                     display help for command

Examples

Convert

To convert a single image to a different format.

$ ensharp convert src/image.jpg output.png  
  This creates an image in png format in `src/converted/output.png`
$ ensharp convert image.jpg output.png  
  This creates an image in png format in `converted` folder in the current directory

You can also specify glob patterns for matching images

$ ensharp convert src/*.jpg *.png  
  This converts all the images with jpg format in `src/` to png formats found in `src/converted/`

Note: If any image has the same name with the output path, the image is overwritten.

Resize

Resize an image to another with width 1080 and height 720

$ ensharp resize src/input.jpg output.png -w 1080 -h 720

Resize an image to multiple sizes

$ ensharp resize src/input.jpg output.png --sizes="1080x720,720x640,640x360,360x200"

You can also specify glob patterns for matching images

$ ensharp resize src/*.jpg *.png -w 1080 -h 720
  Resize all images with jpg format in `src/`

$ ensharp resize src/*.jpg *.png --sizes="1080x720,720x640,640x360,360x200"
  Resize all images with jpg format in `src/` to multiple sizes specified

Note: Resize creates a resized folder inside the specified directory or in the current directory (when a directory is not specified)