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-convertor

v1.0.13

Published

A CLI tool for image conversion and resizing using Node.js and Sharp.

Downloads

3

Readme

img-convertor

img-convertor is a command-line tool based on Node.js and the Sharp library for batch image conversion and resizing. It supports various image formats and can recursively process all images in the specified directory.

Installation

Before using this tool, ensure that Node.js and npm are installed. Then run the following command to install the tool globally:

npm install -g img-convertor

Usage

This tool provides two main commands: converter and resize.

1. Convert Image Formats

Use the converter command to convert the format of all images in a directory:

converter <sourceTypes> <targetType>
  • <sourceTypes>: The source image formats to convert (e.g., png,jpg,jpeg). Optional, defaults to png,jpg,jpeg,webp,gif,bmp.
  • <targetType>: The target image format (e.g., png, jpeg, webp). Optional, defaults to png.

Example:

converter jpg png

Converts all .jpg images in the current directory to .png format and saves them in the output directory.

2. Resize Images

Use the resize command to resize images:

resize <sourceTypes> <targetType> <width> <height>
  • <sourceTypes>: The source image formats to resize (e.g., png,jpg,jpeg). Optional, defaults to png,jpg,jpeg,webp,gif,bmp.
  • <targetType>: The target image format (e.g., png, jpeg, webp). Optional, defaults to png.
  • <width> and <height>: Specify the target width and height of the images in pixels.

Example:

resize jpg png 800 600

Converts all .jpg images in the current directory to .png format, resizes them to 800x600 pixels, and saves them in the output directory.

Supported Image Formats

  • Input formats: png, jpg, jpeg, webp, gif, bmp.
  • Output formats: jpeg, png, webp, tiff, gif, avif, svg.

Notes

  • The converted or resized images will be saved in the output folder in the current directory.
  • If <sourceTypes> and <targetType> are not provided, the program will use default values.
  • For resizing images, both width and height parameters are required.

Dependencies

This tool is built on the sharp library. Please ensure your environment supports this library.

img-convertor

img-convertor 是一个基于 Node.js 和 Sharp 库的命令行工具,用于批量转换和调整图像大小。它支持多种图像格式,并且可以递归处理指定目录中的所有图片。

安装

在使用前,请确保已安装 Node.jsnpm,然后执行以下命令来全局安装此工具:

npm install -g img-convertor

使用方法

该工具提供两个主要命令:converterresize

1. 转换图片格式

使用 converter 命令转换目录中的所有图片格式:

converter <sourceTypes> <targetType>
  • <sourceTypes>:要转换的源图像格式(例如:png,jpg,jpeg)。可选,默认支持 png,jpg,jpeg,webp,gif,bmp
  • <targetType>:目标图像格式(例如:pngjpegwebp 等)。可选,默认为 png

示例:

converter jpg png

将当前目录中的所有 .jpg 图片转换为 .png 格式,并保存在 output 目录中。

2. 调整图片大小

使用 resize 命令调整图片大小:

resize <sourceTypes> <targetType> <width> <height>
  • <sourceTypes>:要调整大小的源图像格式(例如:png,jpg,jpeg)。可选,默认支持 png,jpg,jpeg,webp,gif,bmp
  • <targetType>:目标图像格式(例如:pngjpegwebp 等)。可选,默认为 png
  • <width><height>:指定目标图片的宽度和高度,单位为像素。

示例:

resize jpg png 800 600

将当前目录中的所有 .jpg 图片转换为 .png 格式,并调整大小为 800x600 像素,结果保存在 output 目录中。

支持的图像格式

  • 输入格式:pngjpgjpegwebpgifbmp
  • 输出格式:jpegpngwebptiffgifavifsvg

注意事项

  • 目标图片会被保存在当前目录下的 output 文件夹中。
  • 在转换或调整大小时,如果没有提供 <sourceTypes><targetType>,程序会使用默认值。
  • 调整图片大小时,必须提供宽度和高度参数。

依赖

本工具基于 sharp 库开发,请确保您的环境支持此库。