欢迎回来

登录 EAKE AI,继续您的智能之旅

忘记密码?
还没有账号?立即注册

图片批量处理 — 图像编辑

2026-07-24 · 未分类

图片批量处理 — 图像编辑

批量处理图片:缩放裁剪、格式转换、水印添加、优化压缩。支持常见图片格式。

Batch images resizing [NO NATIVE DEPENDENCIES NEEDED]

![Build Status](https://travis-ci.org/andrew-medvedev/image-batch)

Easy module for resizing of large amount of images

Powered by Jimp which does not require any native dependencies

Just use

image-batch -D path/to/images --resize 50% --postfix m

Motivation

Need to resize huge amount of images.

For example here is directory with big amount of device mockups of different image types:

iphone_6.png iphone_6_gold.jpg iphone_mockup.jpg mockup_htc_8.png galaxy-note-4-psd-mockup.png

The task: Produce iPhone mockups of 3 types(100% size with -l postfix, 50% size with -m postfix and 25% size with -s postfix) and png format.

Here is how to get things done with image-batch: Let's create 100% size mockups for beginning:

image-batch -D path/to/mockups --name iphone% --resize 100% --save-as png --postfix l

Now our directory look like this:

iphone_6.png iphone_6_gold.jpg iphone_mockup.jpg iphone_6-l.png iphone_6_gold-l.png iphone_mockup-l.png mockup_htc_8.png galaxy-note-4-psd-mockup.png

Next we need 50% size mockups:

image-batch -D path/to/mockups --name iphone% --no-name iphone%-l --resize 50% --save-as png --postfix m

And 25% size:

image-batch -D path/to/mockups --name iphone% --no-name iphone%-l,iphone%-m --resize 25% --save-as png --postfix s --remove-original

Here is how our directory should look like on finish:

iphone_6-l.png iphone_6_gold-l.png iphone_mockup-l.png iphone_6-m.png iphone_6_gold-m.png iphone_mockup-m.png iphone_6-s.png iphone_6_gold-s.png iphone_mockup-s.png mockup_htc_8.png galaxy-note-4-psd-mockup.png

Installation

npm install -g image-batch

Usage

image-batch --help
Usage: image-batch [options]

Options:
 -V, --version          Prints version
 -H, --help             Prints this message

 -R, --resize           Set resize query
 -D, --directory                Set base directory where images are
 -N, --name             Filename search pattern. Can be listed with comma
 -NN, --no-name         Filename excluding pattern. Can be listed with comma
 -OF, --only-format             Set exclusive image format to process
 -WOF, --without-format         Set image format that will be not processed
 -P, --postfix          Set name postfix for output files
 -F, --formats          Set exclusive list of formats separated by commas
 -S, --save-as          Set format for output files
 -REMOVE, --remove-original             Set remove original files flag

安装

# 安装到当前项目
npx skills add image-batch

# 全局安装
npx skills add image-batch -g

来源

评论区

该文章暂未开放评论功能。