Socket
Socket
Sign inDemoInstall

imgto

Package Overview
Dependencies
53
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    imgto

Image format conversion


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

批量图片转换小工具

NodeJS版本最低 12.20.0,为了更好的体验建议版本14.x

示例

必须进入图片所在的目录执行转换指令

cd src/assets/images # 进入要转换的图片目录
cd src/assets/images/output # 转换后的图片所在目录
默认转换为webp,无压缩,宽高不变
npm i -g imgto # 全局安装
imgto # 执行批量转换
免安装使用:
npx imgto -w 100 -h 50 -t jpeg --fit cover
免安装图片格式转换
npm init imgto png
yarn create imgto png

选项

参数默认值参数类型描述
-w,--width原始宽度Number图片转换后宽度
-h,--height原始高度Number图片转换后高度
-t,--typewebpString转换的图片类型,支持:jpegjpgpngwebpgifjp2tiffavifheifrawtile
-q,--quality100Number图片进行压缩,支持:1-100【100为不压缩】
--fitcoverString裁剪或拉伸时 可选的参数,支持:covercontainfillinsideoutside

压缩

imgto --quality 60 # 执行此指令对图片进行压缩 支持 1-100

格式转换

imgto --type webp # 执行此指令对图片格式进行转换 支持 jpg|jpeg,png,webp

帮助

imgto --help

Keywords

FAQs

Last updated on 19 Aug 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc