
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Fast image format converter CLI for macOS and Windows - Convert images to WebP, AVIF, JPEG, PNG with batch processing support
快速圖片格式轉換 CLI 工具,支援 macOS 和 Windows 11。
npm install -g imgtran
npm install --save-dev imgtran
npx imgtran -i ./images -o ./output
互動模式提供直覺的選單式界面,讓您輕鬆設定所有選項:
# 啟動互動模式
imgtran --interactive
# 或指定輸入資料夾後啟動互動模式
imgtran --interactive -i ./photos
互動模式會逐步詢問:格式、品質、輸出路徑等選項,並可將設定儲存為預設值。
# 轉換當前目錄的 images 資料夾到 output
imgtran
# 指定輸入和輸出資料夾
imgtran -i ./src/images -o ./dist/images
# 指定格式和品質
imgtran -i ./images -o ./output -f avif -q 85
# 產生 ZIP 壓縮包
imgtran -i ./images -o ./output --zip
# PowerShell
imgtran -i .\images -o .\output --quality 90
# CMD
imgtran -i .\images -o .\output --quality 90
# Git Bash
imgtran -i ./images -o ./output --quality 90
# 基本轉換
imgtran -i ~/Pictures/photos -o ~/Pictures/optimized
# 遞迴處理子資料夾
imgtran -i ./images -o ./output --recursive
# 詳細輸出
imgtran -i ./images -o ./output --verbose
選項:
-i, --input <path> 輸入資料夾路徑 (預設: "./images")
-o, --output <path> 輸出資料夾路徑 (預設: "./output")
-q, --quality <number> 轉換品質 1-100 (預設: 90)
-f, --format <format> 輸出格式: webp, avif, jpeg, jpg, png, gif (預設: "webp")
--prefix <string> 檔名前綴
--suffix <string> 檔名後綴
-z, --zip 產生 ZIP 壓縮包
-r, --recursive 遞迴處理子資料夾
--overwrite 覆寫已存在的檔案
-c, --config <path> 設定檔路徑
-v, --verbose 詳細輸出
--interactive 🎨 互動模式:顯示選項選單
-V, --version 顯示版本
-h, --help 顯示幫助
imgtran 支援三種層級的設定檔,優先順序如下:
imgtran.config.js 或 .imgtranrc)~/.imgtranrc)(最低優先)在你的家目錄建立 .imgtranrc 檔案,所有專案都會使用這些預設設定:
macOS / Linux:
# 建立全域設定檔
nano ~/.imgtranrc
Windows:
# 建立全域設定檔
notepad C:\Users\你的用戶名\.imgtranrc
設定檔內容(JSON 格式):
{
"quality": 90,
"format": "webp",
"suffix": "_optimized",
"verbose": true,
"zip": false
}
建立 imgtran.config.js 或 .imgtranrc 在專案根目錄(會覆蓋全域設定):
// imgtran.config.js
export default {
input: './images',
output: './output',
quality: 90,
format: 'webp',
prefix: '',
suffix: '_optimized',
zip: false,
recursive: false,
overwrite: false,
verbose: true,
}
{
"input": "./images",
"output": "./output",
"quality": 90,
"format": "webp",
"zip": true
}
使用設定檔:
# 自動搜尋設定檔
imgtran
# 指定設定檔
imgtran -c ./my-config.js
imgtran -i ./png-images -o ./webp-images -f webp -q 90
imgtran -i ./images -o ./optimized --suffix "_opt" -f avif
imgtran -i ./assets -o ./dist --recursive -v
imgtran -i ./photos -o ./compressed --zip -f jpeg -q 85
{
"scripts": {
"optimize": "imgtran -i ./public/images -o ./public/optimized",
"build:images": "imgtran -c imgtran.config.js"
}
}
你也可以在 Node.js 專案中將 imgtran 作為 library 使用:
import { convertImage, scanInputFiles } from 'imgtran'
const files = await scanInputFiles('./images')
// 處理圖片...
# 安裝 Node.js
winget install OpenJS.NodeJS
# 重啟 PowerShell
# 使用 sudo 安裝
sudo npm install -g imgtran
Sharp 會自動下載對應平台的 binary,如果失敗:
# 清除快取重新安裝
npm cache clean --force
npm install -g imgtran
MIT
歡迎提交 Issue 和 Pull Request!
FAQs
Fast image format converter CLI for macOS and Windows - Convert images to WebP, AVIF, JPEG, PNG with batch processing support
We found that imgtran demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.