็ปๅใใพใจใใฆ**่ปฝใ๏ผใใกใคใซใตใคใบใๅฐใใ๏ผ**ใงใใใใผใซใงใใ่ณชๅใซ็ญใใใ ใใง JPG / WebP / PNG / GIF ใธใฎๅคๆใปๅง็ธฎใใงใใพใใ็ปๅ็ทจ้ใฎ็ฅ่ญใฏไธ่ฆใ macOS / Windows / Linux ใงๅใใใใซๅใใพใใPowered by sharp.
๐ฌ๐ง English version is at the bottom of this page โ jump to English โ.
่จ่ช / Languages: ๆฅๆฌ่ช๏ผใฏใใใฆใฎๆนใธ๏ผ ยท English
FitImage ใฏใใใฉใซใใฎไธญใฎ็ปๅใ**ใพใจใใฆ่ปฝใ๏ผใใกใคใซใตใคใบใๅฐใใ๏ผ**ใงใใ
ใใผใซใงใใ็ปๅ็ทจ้ใฝใใใ้ใๅฟ
่ฆใฏใใใพใใใJPG / WebP / PNG / GIF ใฎ
ๅฝขๅผๅคๆใใงใใพใ๏ผไพ๏ผ้ใ .png ใฎในใฏใชใผใณใทใงใใใ่ปฝใ .webp ใซใ
.gif ใ่ปฝใ .jpg ใ .webp ใซ๏ผใ
ใใใใใใณใใณใใฏไธ่ฆใงใใfitimage ใจๅ
ฅๅใใใจใ่ณชๅใซ็ญใใใ ใใง
ๅฆ็ใงใใพใใmacOS / Windows / Linux ใงๅใใใใซๅใใพใใ
ใใจใใฐใใใช็ตๆใซใชใใพใ๏ผ
24.3 MB โ 6.1 MB ๏ผ็ด75%ๅฐใใใชใใพใใ๏ผ
๐ ๅฎๅฟใใฆ่ฉฆใใพใใ ๅ ใฎ็ปๅใใใฎใพใพๆฎใใๅฅๅใงไฟๅญใใใไฝใๆธใๆใใใซ ็ตๆใ ใ็ขบ่ชใใใใใฌใใฅใผ๏ผdry-run๏ผใใใใใพใ โ ๅ ใฎ็ปๅใฏๆถใใพใใใ๏ผ
ๆ้ 1ใจ2ใฏๆๅใฎไธๅบฆใ ใใๆฌกๅใใใฏๆ้ 3ใป4ใ ใใงใใ
FitImage ใฏ Node.js ใจใใ็กๆใใผใซใฎไธใงๅใใพใใ
- https://nodejs.org/ ใ้ใ
- ็ท่ฒใฎๅคงใใช ใLTSใ ใใฟใณใใใใฆใณใญใผใใใฆใใคใณในใใผใฉใผใๅฎ่ก
- ใๆฌกใธ / ็ถใใใใๆผใใฆใใใ ใ๏ผๅๆ่จญๅฎใฎใพใพใงOK๏ผ
็ขบ่ชใใใซใฏใใฟใผใใใซ๏ผโๆ้ 3๏ผใงใใๅ ฅๅใใพใ๏ผ
node -vv20.11.1 ใฎใใใชๆฐๅญใๅบใใฐๆบๅๅฎไบใงใ๏ผ18ไปฅไธใชใOK๏ผใ
ใฟใผใใใซใงๆฌกใๅ ฅๅใใฆ Enter๏ผ
npm install -g @ecgear/fitimageๅ ฅใฃใใ็ขบ่ช๏ผ
fitimage --versionๆฐๅญใๅบใใฐๅฎไบใงใใ๐
๐ก ใคใณในใใผใซใใใใชใๅ ดๅใฏใ
npx @ecgear/fitimageใงใใใฎ้ฝๅบฆๅฎ่กใงใใพใ ๏ผ่ตทๅใฏๅฐใ้ ใใงใใใๆบๅไธ่ฆใงใ๏ผใ
ใใฟใผใใใซใใฏใณใใณใใๅ ฅๅใใ็ชใงใใ
- macOS โฆ
โ+Spaceโใใฟใผใใใซใใจๅ ฅๅใใฆ Enter - Windows โฆ
โ(Windows)ใญใผ โใใฟใผใใใซใใพใใฏใPowerShellใใจๅ ฅๅใใฆ Enter - Linux โฆ ใขใใชไธ่ฆงใใใ็ซฏๆซ๏ผTerminalใใ้ใ
ๆฌกใๅ ฅๅใใฆ Enter๏ผ
fitimageใใจใฏๆกๅ
ใซๅพใใ ใใงใใๅฎ้ใฎ่กจ็คบไพ๏ผ> ใใใญใณใใใฎๅพใใใใชใใฎๅ
ฅๅ๏ผ๏ผ
FitImage โ interactive mode
Target folder [/Users/you]: /Users/you/Pictures/ๆ
่ก
12 image(s) found under /Users/you/Pictures/ๆ
่ก:
- IMG_0001.jpg
- IMG_0002.jpg
... and 10 more
These 12 image(s) will be processed.
Output format (size-reduced): โ ๅบๅๅฝขๅผ
1) JPG (.jpg)
2) WebP (.webp)
3) GIF (.gif) โ ๅ็ใฏ้ใซๅคงใใใชใใใจใใใใพใ
4) PNG (.png)
> 2
Save mode: โ ไฟๅญๆนๆณ
1) Overwrite originals (in place) ๏ผไธๆธใ๏ผ
2) Save as a new name (keep originals) ๏ผๅฅๅใงไฟๅญใปๅ
ใฏๆฎใ๏ผ
> 2
Plan: โ ๅฎ่กๅ
ๅฎนใฎ็ขบ่ช
Folder : /Users/you/Pictures/ๆ
่ก
Images : 12
Output : .webp (quality 75)
Naming : save as .webp next to originals (same name, originals kept)
Proceed? โ ๅฎ่กใใพใใ๏ผ
1) Run now ๏ผไปใใๅฎ่ก๏ผ
2) Dry-run preview first (write nothing) ๏ผใพใ็ขบ่ชใปๆธใ่พผใฟใชใ๏ผ
3) Cancel ๏ผไธญๆญข๏ผ
> 1
Done.
12 image(s) | written: 12 | skipped: 0 | errors: 0
24.3 MB -> 6.1 MB (saved 18.2 MB, 74.9%)
One-Shot Command โ turn this run into a single reusable command?
1) Yes โ show me the command โ ใฏใใปใณใใณใใ่กจ็คบ
2) No thanks ๏ผใใใ๏ผ
> 1
One-Shot Command โ run this in your terminal to repeat exactly this operation:
fitimage "/Users/you/Pictures/ๆ
่ก" --format webp --keep-original
Next time, just paste this command instead of answering the questions โ
it reproduces this run in a single step.
ใใฎไพใงใฏใใใฉใซใใฎ็ปๅใใในใฆๅใๆกๅผตๅญ๏ผ.jpg๏ผใงใๅบๅใซๅฅใฎๅฝขๅผ๏ผ.webp๏ผใ
้ธใใ ใฎใงใใใกใคใซๅใฏใใฎใพใพใซ IMG_0001.webp โฆใไฝใใใๅ
ใฎ IMG_0001.jpg โฆใฏ
ใใฎใพใพๆฎใใพใ๏ผๆกๅผตๅญใ้ใใฎใงๅๅใงใไธๆธใใใใพใใ๏ผใใใฎใจใใไปใ่ถณใๆๅญใใฏ
ไธ่ฆใชใฎใง่ณชๅใใใพใใใ
๐ก ใไปใ่ถณใไฝ็ฝฎ๏ผPrefix/Suffix๏ผใใ่ใใใใฎใฏใฉใใชๆ๏ผ โฆ ๅบๅใซๅใๅฝขๅผใ้ธใใ ๅ ดๅ๏ผไพ:
.jpgใ.jpgใซๅง็ธฎ๏ผใใใใฉใซใใซ่คๆฐใฎๆกๅผตๅญใๆททๅจใใฆใใๅ ดๅใงใใ ใใฎใจใใฏๆฐใใกใคใซใๅ ใจๅๅใปๅๆกๅผตๅญใซใชใๅพใใใใๅบๅฅ็จใฎๆๅญ๏ผๅ ้ ญ/ๆซๅฐพ๏ผใๅฐใญใพใใ
๐ ๆฌกๅใใใฏใๅๅใฎใใฉใซใใ่ชๅใงๆ็คบใใใพใใEnter ใงๅๅฉ็จใๅฅใฎ ใในใๅ ฅๅใใใฐๅคๆดใงใใพใใ
ๅฆ็ใ็ตใใใจใๆๅพใซ ใOne-Shot Command๏ผใฏใณใทใงใใใปใณใใณใ๏ผใไฝใใพใใ๏ผใ ใจ่ใใใพใใใYesใ ใ้ธใถใจใไปๅใจใพใฃใใๅใๆไฝใ 1 ่กใงๅฎ่กใงใใใณใใณใ ใ่กจ็คบใใใพใใไพ๏ผ
fitimage "/Users/you/Pictures/ๆ
่ก" --format webp --keep-originalๆฌกๅใใใฏใ่ณชๅใซ็ญใใไปฃใใใซ ใใฎใณใใณใใใฟใผใใใซใซ่ฒผใไปใใฆ Enter ใใ ใ ใใๅใใใฉใซใใปๅใๅฝขๅผใปๅใไฟๅญๆนๆณใงใใกใใฅใผใชใใฎๆ็ญในใใใใงๅฎ่กใงใใพใใ
- ใใฉใซใใฎใในใซในใใผในใๆฅๆฌ่ชใๅซใพใใๅ ดๅใฏใ่ชๅใง
"โฆ"ใงๅฒใพใใพใ ๏ผใใฎใพใพใณใใใงOK๏ผใ - ใคใณในใใผใซใใ
npxใงไฝฟใฃใฆใใๆนใฏใๅ ้ ญใซnpx @ecgear/fitimageใไปใใฆใใ ใใใ - ๅใชใใทใงใณใฎๆๅณใฏใไธใฎ English ใปใฏใทใงใณใฎ Options ่กจใซใพใจใใฆใใพใใ
ๆๅ ฅๅใใชใใฆๅคงไธๅคซใงใใ
- macOS / Linux โฆ Finder/ใใกใคใซใใใใฉใซใใใฟใผใใใซใซใใฉใใฐ&ใใญใใ ใใใจใในใๅ ฅใใพใใใใฎใพใพ Enterใ
- Windows โฆ ใจใฏในใใญใผใฉใผใง Shift ใๆผใใชใใใใฉใซใใๅณใฏใชใใฏ โ ใใในใฎใณใใผใ ใ้ธใณใใฟใผใใใซใซ่ฒผใไปใ๏ผๅณใฏใชใใฏใง่ฒผใไปใ๏ผใ
ใใชใใ้ธใใ ใจใใใซใใๅใใพใใใใSave mode๏ผไฟๅญๆนๆณ๏ผใใง้ธใณใพใ๏ผ
| ้ธๆ | ใฉใใชใ | ใใใใ |
|---|---|---|
| ๅฅๅใงไฟๅญ๏ผSave as a new name๏ผ | ๅ
ใฏใใฎใพใพใ่ปฝใใใใณใใผใ้ฃใซไฝใใๅบๅใๅฅๅฝขๅผใชใๅๅใปๅฅๆกๅผตๅญใงไฟๅญ๏ผไพ .jpgโ IMG.webp๏ผใๅใๅฝขๅผใชใๅบๅฅ็จใฎๆๅญ๏ผๅ
้ ญ/ๆซๅฐพ๏ผใไปใใฆไฟๅญใ |
๐ ใพใใฏใใใๅฎๅ จ |
| ไธๆธใ๏ผOverwrite originals๏ผ | ๅ
ใใกใคใซใ่ปฝใ็ใซ็ฝฎใๆใใๅฝขๅผใๅคใใๅ ดๅ๏ผไพ .pngโ.webp๏ผใฏๅ
ใใกใคใซใฏๅ้คใ |
ๅ ใไธ่ฆใชใจใ |
ใใใซๅฎๅฟใชไป็ตใฟ๏ผ
- ใใฌใใฅใผ๏ผDry-run๏ผ โฆ ๆๅพใซใDry-run preview firstใใ้ธใถใจใไฝใๆธใ่พผใพใใซ ใใใใชใใพใใใจใใ็ตๆใ ใ็ขบ่ชใงใใพใใ
- ๅใๅฝขๅผใงไธๆธใใใๅ ดๅใๅฐใใใชใใชใใใกใคใซใฏ่ชๅใงในใญใใใใพใใ
- ๐พ ๅคงๅใชๅ็ใฏใๅฟตใฎใใใใฉใซใใใจใณใใผใใฆใใๅฎ่กใใใจ็ขบๅฎใงใใ
| ๅฝขๅผ | ๅใใฆใใ็จ้ | ใกใข |
|---|---|---|
| JPG | ๅ็ | ไธ่ฝใใใกใคใซใๅฐใใใ้้ใฏไธๅฏ |
| WebP | Web็จใฎๅ็ | JPGใใใใใซๅฐใใใใจใๅคใใๆๆฐใใฉใฆใถใง่กจ็คบๅฏ |
| PNG | ในใฏใทใงใปใญใดใป้้็ปๅ | ่ผช้ญใใใฃใใใJPG/WebPใใๅคงใใ |
| GIF | ใฉใใใฆใ .gif ใๅฟ
่ฆใชใจใใ ใ |
256่ฒใๅ็ใฏ้ใซๅคงใใใชใใใจใใ |
่ฟทใฃใใใๅ็ใฏ JPGใWebใซ่ผใใใชใ WebPใ
GIF ใๅคๆใใใๅ ดๅ:
.gifใใกใคใซใๅ ฅๅใจใใฆๅฏพๅฟใใฆใใพใใใใฉใซใใซ.gifใๅ ฅใฃใฆใใใฐใๅบๅๅฝขๅผใซ JPG / WebP / PNG ใ้ธใถใใจใงๅคๆใงใใพใ ๏ผใขใใกใผใทใงใณ GIF ใฏๆๅใฎใใฌใผใ ใฎใฟๅคๆใใใพใ๏ผใ
ใcommand not found: fitimageใใจๅบใ
Node.js ใ FitImage ใใพใ ๅ
ฅใฃใฆใใชใใใใคใณในใใผใซๅใใใฟใผใใใซใ้ใใฆใใ
ๅฏ่ฝๆงใๆ้ 1ใปๆ้ 2ใ่กใใใฟใผใใใซใใใฃใใ้ใใฆ้ใ็ดใใฆใใ ใใใ
ใคใณในใใผใซใงๆจฉ้ใจใฉใผ๏ผEACCES๏ผใๅบใ๏ผmacOS/Linux๏ผ
https://nodejs.org/ ใฎๅ
ฌๅผใคใณในใใผใฉใผใไฝฟใใใใคใณในใใผใซใใ npx @ecgear/fitimage
ใงๅฎ่กใใฆใใ ใใใ
็ปๅใฎใตใคใบ๏ผ็ธฆๆจชใฎๅคงใใ๏ผใฏๅคใใใพใใ๏ผ ๅคใใใพใใใใใกใคใซๅฎน้ใๅฐใใใใ๏ผใจๅฝขๅผใๅคใใ๏ผใ ใใงใใ
GIF ใซใใใ้ใซๅคงใใใชใฃใ ไปๆงใงใใGIFใฏ256่ฒใชใฎใงๅ็ใฏๅคงใใใชใใใกใๅ็ใฏ JPG ใ WebP ใใๅขๆธใฏๆฏๅ ่กจ็คบใใใพใใ
ใคใณใฟใผใใใใฏๅฟ ่ฆ๏ผ ใคใณในใใผใซๆใ ใใใใจใฏๅฎๅ จใชใใฉใคใณใงๅใใพใใ
ๆฐใใใใผใธใงใณใๅบใใใจใ็ฅใใซใฏ๏ผ FitImage ใฏ1ๆฅ1ๅใใใฏใฐใฉใฆใณใใงๆดๆฐ็ขบ่ชใ่กใใๆฐใใใใผใธใงใณใๅบใฆใใใฐ ๆฌกๅใฎ่ตทๅๆใซๆกๅ ใ่กจ็คบใใพใ๏ผ
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Update available 0.3.1 โ 0.4.0 โ
โ Run npm install -g @ecgear/fitimage to update โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
่กจ็คบใใใใณใใณใใๅฎ่กใใใ ใใงๆๆฐ็ใซใชใใพใใ ใพใใGitHub ใฎใชใใธใใช ใใWatch โ Releases onlyใ ใซ่จญๅฎใใฆใใใจใใกใผใซใงใชใชใผใน้็ฅใๅใๅใใพใใ
ใใไฝฟใๅง็ธฎๆไฝใ ใใกใคใซใใใฉใซใใฎๅณใฏใชใใฏใกใใฅใผ ใซ็ป้ฒใงใใพใใ ็ป้ฒใใใจใ็ปๅใใใฉใซใใๅณใฏใชใใฏใใฆใกใใฅใผใ้ธใถใ ใใงใใฟใผใใใซใ ้ใใใซๅใๅฆ็ใๅฎ่กใงใใพใใๅฆ็ใฏ้ใใซ่ตฐใใ็ตใใใจ้็ฅใๅบใพใใ
ใฏใณใทใงใใใณใใณใ๏ผๆไฝๅพใซ่กจ็คบใใใ fitimage โฆ ใฎ1่ก๏ผใฎๆซๅฐพใซ
--install-menu ใไปใใฆๅฎ่กใใพใใ้ๅธธใฎใฆใฃใถใผใใจใฏๅฅใฎใๅฐใใชใคใณในใใผใฉใ
่ตทๅใใพใใ
# ไพ๏ผใWebP ใซๅคๆใใฆๅ
็ปๅใฏ *_min.webp ใงๆฎใใใใกใใฅใผใซ่ฟฝๅ
fitimage --format webp --suffix _min --install-menu- ใAdd / update a right-click menu entryใ๏ผ่ฟฝๅ ใปๆดๆฐ๏ผใ้ธใณใพใใ
- ใกใใฅใผๅ๏ผใฉใใซ๏ผ ใๅ
ฅๅใใพใใใใใงๅ
ฅๅใใๅๅใใๅณใฏใชใใฏ
ใกใใฅใผใซใใฎใพใพ่กจ็คบใใใพใ๏ผไพ๏ผ
WebPใซๅคๆ๏ผใ - ใใใงๅฎไบใงใใ็ปๅใใใฉใซใใๅณใฏใชใใฏใใฆใใใฎๅๅใ้ธในใฐๅฎ่กใงใใพใใ
ใฉใใซใๅคใใใฐใใใใคใงใ่ฟฝๅ ใงใใพใ๏ผๆๅคง 10 ๅ๏ผใ ไพใใฐใJPGใซๅง็ธฎใใจ ใWebPใซๅคๆใใๅฅใ ใซ็ป้ฒใใฆใใใฐใๅณใฏใชใใฏใกใใฅใผใใ็จ้ใซๅฟใใฆ้ธในใพใใ
- ๅฅใฎๅๅใง็ป้ฒใใใจใๆฐใใ้ ็ฎใจใใฆ ่ฟฝๅ ใใใพใใ
- ๅใๅๅใง็ป้ฒใ็ดใใจใใใฎ้ ็ฎใ ๆดๆฐ ใใใพใ๏ผ่จญๅฎใๅคใใใใจใ๏ผใ
ใใไธๅบฆ fitimage --install-menu ใๅฎ่กใใฆใ
- ใRemove a right-click menu entryใ๏ผๅ้ค๏ผใ้ธใณใพใใ
- ็ป้ฒๆธใฟใฎไธ่ฆงใ่กจ็คบใใใใฎใงใๅ้คใใใ้ ็ฎ ใ้ธใณใพใใ ใในใฆๆถใใใใจใใฏ ใAll FitImage entriesใ๏ผใในใฆๅ้ค๏ผใ้ธใณใพใใ
๐ก ๅผๆฐใชใใฎ
fitimage --install-menuใ ใใงใใคใณในใใผใฉใฏ่ตทๅใใพใ ๏ผๅ้คใไธ่ฆงใฎ็ขบ่ชใ ใใใใใจใใซไพฟๅฉใงใ๏ผใ
- macOS โฆ
~/Library/Servicesใซ Automator ใฎใฏใคใใฏใขใฏใทใงใณใไฝๆ ใใพใ๏ผๅณใฏใชใใฏ โใใฏใคใใฏใขใฏใทใงใณใ๏ผใ็ฎก็่ ๆจฉ้ใฏไธ่ฆใงใใ - Windows โฆ ็ปๅใใกใคใซใจใใฉใซใๅใใซใฆใผใถใผๅไฝใฎใฌใธในใใช้ ็ฎใ่ฟฝๅ ใใ ๅฐใใช VBScript ็ต็ฑใงใฆใฃใณใใฆใๅบใใใซๅฎ่กใใพใใWindows 11 ใงใฏ ใใใฎไปใฎใชใใทใงใณใ่กจ็คบใใฎไธญใซๅบใใใจใใใใพใใ็ฎก็่ ๆจฉ้ใฏไธ่ฆใงใใ
โ ๏ธ ใกใใฅใผใซใฏ ็ป้ฒใใๆ็นใฎ Node.js ใฎๅ ดๆ ใ่จ้ฒใใใพใใNode ใๅ ฅใ็ดใใจ ใกใใฅใผใๅใใชใใชใใใจใใใใพใใใใฎๅ ดๅใฏ Add / update ใงๅใใฉใใซใ ้ธใณใไฝใ็ดใใฆใใ ใใใ
่ฉณใใไฝฟใๆน๏ผใณใใณใใฎใชใใทใงใณใปใใญใฐใฉใ ใใใฎๅฉ็จใปใฉใคใปใณใน๏ผใฏใไธใฎ English ใปใฏใทใงใณใซใพใจใใฆใใพใใ
Make your images smaller โ and convert between JPG / WebP / PNG / GIF โ by answering a few simple questions. No image-editing skills required. Works the same on macOS, Windows and Linux.
๐ฏ๐ต ๆฅๆฌ่ชใฎใฌใคใใฏใใฎใใผใธไธ้จใซใใใพใ โ ๆฅๆฌ่ช๏ผใฏใใใฆใฎๆนใธ๏ผโ.
FitImage takes a folder full of pictures and makes the files smaller so they
upload faster and take less space โ without you having to open each one in an
image editor. It can also change the file type (for example turn heavy .png
screenshots into light .webp or .jpg, or convert .gif files to .jpg or .webp).
You don't need to type complicated commands: just run fitimage and it will
ask you what to do, step by step.
A typical result:
24.3 MB โ 6.1 MB (saved 18.2 MB, about 75% smaller)
๐ It's safe to try. FitImage can keep your originals untouched (it offers a "save as a new name" option) and has a preview mode that shows what would happen without changing anything. See Will it ruin my originals?
You only do Steps 1 and 2 once. After that, using FitImage is just Step 3 + 4.
FitImage runs on a free tool called Node.js.
- Go to https://nodejs.org/
- Download the big green โLTSโ button and run the installer.
- Click Next / Continue through the installer (the defaults are fine).
To check it worked, open a terminal (see Step 3) and type:
node -vIf you see a version number like v20.11.1, you're ready. (Any number 18 or
higher is fine.)
In the terminal, type this and press Enter:
npm install -g @ecgear/fitimageCheck it installed:
fitimage --versionIf you see a version number, you're done. ๐
๐ก Don't want to install anything? You can also run FitImage on demand with
npx @ecgear/fitimageinstead of installing it. It's a little slower to start but needs no setup.
The "terminal" is a window where you type commands.
- macOS โ Press
โ Command+Space, type Terminal, press Enter. - Windows โ Press the
โ Windowskey, type Terminal (or PowerShell), press Enter. - Linux โ Open your Terminal app from the applications menu.
Type this and press Enter:
fitimageFitImage now guides you. Here is a real example โ the lines after > and after
prompts are what you type:
FitImage โ interactive mode
Target folder [/Users/you]: /Users/you/Pictures/trip
12 image(s) found under /Users/you/Pictures/trip:
- IMG_0001.jpg
- IMG_0002.jpg
- IMG_0003.jpg
... and 9 more
These 12 image(s) will be processed.
Output format (size-reduced):
1) JPG (.jpg)
2) WebP (.webp)
3) GIF (.gif) โ 256-colour palette; photos may end up larger
4) PNG (.png)
> 2
Save mode:
1) Overwrite originals (in place)
2) Save as a new name (keep originals)
> 2
Plan:
Folder : /Users/you/Pictures/trip
Images : 12
Output : .webp (quality 75)
Naming : save as .webp next to originals (same name, originals kept)
Proceed?
1) Run now
2) Dry-run preview first (write nothing)
3) Cancel
> 1
Done.
12 image(s) | written: 12 | skipped: 0 | errors: 0
24.3 MB -> 6.1 MB (saved 18.2 MB, 74.9%)
One-Shot Command โ turn this run into a single reusable command?
1) Yes โ show me the command
2) No thanks
> 1
One-Shot Command โ run this in your terminal to repeat exactly this operation:
fitimage /Users/you/Pictures/trip --format webp --keep-original
Next time, just paste this command instead of answering the questions โ
it reproduces this run in a single step.
In this example, every image shares one extension (.jpg) and the output uses a
different format (.webp), so IMG_0001.webp โฆ are created with the same
names and the originals (IMG_0001.jpg โฆ) are kept next to them (a different
extension can't overwrite them). No "text to add" is needed, so it isn't asked.
๐ก When is "Where should the text be added?" asked? When you pick the same format as your files (e.g.
.jpgโ.jpg), or the folder mixes extensions โ there the new file could share the original's name and extension, so FitImage asks for a distinguishing prefix/suffix.
๐ Next time you run
fitimage, it remembers the last folder and offers it automatically โ just press Enter to reuse it, or type a different path.
When a run finishes, FitImage asks "One-Shot Command โ turn this run into a
single reusable command?" Choose Yes and it prints the exact fitimage
command that reproduces what you just did, for example:
fitimage /Users/you/Pictures/trip --format webp --keep-originalNext time, instead of answering the questions, just paste that command into your terminal and press Enter โ same folder, same format, same save mode, in a single step with no menus.
- Folder paths that contain spaces or non-ASCII characters are automatically
wrapped in
"โฆ"so you can copy-paste them as-is (works in bash/zsh and Windows PowerShell/cmd). - If you run FitImage with
npxinstead of installing it, prefix the command withnpx @ecgear/fitimage. - See the Options table below for what each flag means.
You don't have to type it by hand:
- macOS / Linux โ drag the folder from Finder/Files into the terminal window and its path appears. Then press Enter.
- Windows โ In File Explorer, hold Shift, right-click the folder, and choose โCopy as pathโ, then paste it into the terminal (right-click to paste).
Short answer: only if you ask it to. When FitImage asks โSave modeโ:
| You choose | What happens | Best for |
|---|---|---|
| Save as a new name | Your originals stay exactly as they are; smaller copies are created next to them. With a different output format the copy keeps the same name and a new extension (e.g. .jpg โ IMG.webp); with the same format it adds the prefix/suffix you choose. |
๐ Most people โ completely safe |
| Overwrite originals | The original files are replaced by the smaller versions. If the file type changes (e.g. .png โ .webp), the old file is removed. |
When you don't need the originals |
Extra safety nets:
- Dry-run preview โ at the final step, pick โDry-run preview firstโ to see exactly what would happen, with nothing written or deleted.
- FitImage skips files that wouldn't actually get smaller (when overwriting in the same format), so it won't make things worse.
- ๐พ If the photos are irreplaceable, make a copy of the folder first โ peace of mind is free.
| Format | Choose it for | Notes |
|---|---|---|
| JPG | Photographs | Great all-round choice; small files; no transparency |
| WebP | Photos for the web | Usually even smaller than JPG; works in all modern browsers |
| PNG | Screenshots, logos, images with transparency | Keeps sharp edges; larger than JPG/WebP |
| GIF | Only if you specifically need a .gif |
256 colours โ photos can end up larger, so avoid it for photos |
Not sure? JPG for photos, WebP if they're going on a website.
Converting from GIF?
.giffiles are accepted as input too. Drop a folder containing GIFs into FitImage and choose JPG, WebP, or PNG as the output format to convert them. (Animated GIFs: only the first frame is kept when converting to a single-image format.)
โcommand not found: fitimageโ (or โ'fitimage' is not recognizedโ)
Node.js or FitImage isn't installed yet, or the terminal was open before you
installed it. Do Step 1 and
Step 2, then close and reopen the
terminal and try again.
A permission error when installing (EACCES) on macOS/Linux.
Use the official installer from https://nodejs.org/ (it sets permissions up
correctly), or simply run FitImage without installing: npx @ecgear/fitimage.
Does it change the size (width/height) of my images? No. FitImage only reduces the file size (and can change the format). The pixels-wide ร pixels-tall stay the same.
It said a GIF got bigger โ is that a bug? No. GIF only supports 256 colours, so photos often grow. Use JPG or WebP for photos. FitImage always shows you the size change so there are no surprises.
Does it need the internet? Only to install. After that it works fully offline.
How do I know when a new version is available? FitImage checks for updates once a day in the background and shows a hint the next time you run it if a newer version is found:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Update available 0.3.1 โ 0.4.0 โ
โ Run npm install -g @ecgear/fitimage to update โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Just run the command shown to upgrade. You can also watch the GitHub repository (Watch โ Releases only) to receive an email whenever a new release is published.
You can skip the questions and pass everything as flags:
# Compress every image under ./images IN PLACE at quality 75 (default)
fitimage ./images
# Preview first โ writes nothing
fitimage ./images --dry-run --verbose
# Non-destructive: write results into ./out, leave sources untouched
fitimage ./images --out ./out
# Convert everything to WebP, saving new files as *_min.webp (originals kept)
fitimage ./images --format webp --suffix _min
# Stronger compression, also turn PNGs into JPGs, keep the original .webp files
fitimage ./images -q 60 --png-to-jpg --keep-original
โ ๏ธ With a<path>and no--prefix/--suffix/--out, FitImage works in place (re-compressed files overwrite the originals; a format change replaces the source file). Use--dry-runto preview, or--prefix/--suffix/--outto keep originals.
| Option | Default | Description |
|---|---|---|
(no path) / -i, --interactive |
โ | Launch the interactive wizard (needs a terminal) |
-q, --quality <n> |
75 |
JPEG/WebP quality (1โ100) |
-f, --format <fmt> |
โ | Force output format: jpg | webp | png | gif |
--prefix <text> |
โ | Save under a new name: add <text> to the start of the filename |
--suffix <text> |
โ | Save under a new name: add <text> to the end of the filename |
-o, --out <dir> |
โ | Write results to this directory (non-destructive) |
--no-recursive |
off | Do not descend into subfolders |
--png-to-jpg |
off | Also convert .png files to .jpg (ignored when --format is set) |
--keep-original |
off | Keep source files when the format changes (e.g. keep .webp) |
--dry-run |
off | Preview only โ write/delete nothing |
-v, --verbose |
off | Print every file |
-c, --concurrency <n> |
4 |
Number of parallel workers |
--install-menu |
off | Open the right-click-menu installer (add / update / remove Finder / Explorer entries), then exit |
--prefix/--suffix always keep the originals (the renamed copy is a new file).
The interactive wizard always uses quality 75; use -q/--quality on the
command line for other values.
Add an operation you use often to your file manager's right-click menu, so you can run it on any image or folder without opening a terminal. It runs quietly and shows a completion notification when finished.
To add an entry, append --install-menu to a one-shot command. A short
installer (a separate prompt โ not part of the normal wizard) then guides you:
# e.g. "convert to WebP, keep originals as *_min.webp" โ added to the menu:
fitimage --format webp --suffix _min --install-menu- Choose "Add / update a right-click menu entry."
- Type a menu label โ the name you type is exactly what appears in the
right-click menu (e.g.
Convert to WebP). - Done. Right-click any image or folder and pick that name to run it.
Add as many as you like (up to 10). Run --install-menu again with a
different label to add another entry, or with the same label to update an
existing one. For example, keep separate Compress to JPG and Convert to WebP
entries and pick whichever you need.
To remove an entry, run fitimage --install-menu again and:
- Choose "Remove a right-click menu entry."
- Pick the entry to delete from the list โ or "All FitImage entries" to remove every one at once.
๐ก Plain
fitimage --install-menu(no other flags) also opens the installer โ handy when you just want to remove or review entries.
Platform details:
- macOS โ installs Automator Quick Actions in
~/Library/Services(right-click โ Quick Actions). No admin rights. - Windows โ adds per-user
HKEY_CURRENT_USERregistry entries for image files and folders, launched hidden via a tiny VBScript (no console window). On Windows 11 they may sit under "Show more options." No admin rights.
The menu remembers the exact Node.js path it was set up with, so if you
reinstall Node, re-run Add / update (same label) to refresh it. Uses only OS
tools (osascript / reg / wscript) โ no extra dependencies.
import { run } from '@ecgear/fitimage';
const { summary } = await run('./images', { quality: 70, out: './out' });
console.log(summary); // { count, written, skipped, errors, origTotal, newTotal, saved, pct }
// Convert to WebP, writing *_min.webp beside each source (originals kept):
await run('./images', { format: 'webp', affix: { position: 'suffix', text: '_min' } });FitImage uses sharp (which wraps libvips) for all decoding/encoding:
- JPEG via mozjpeg / libjpeg-turbo (BSD / IJG)
- PNG via zlib / libpng โ re-encoded with
palette: false(truecolour) - WebP via libwebp (BSD)
- GIF via cgif (MIT) + sharp's bundled BSD-2-Clause fork of libimagequant for palette quantization โ not the GPL upstream
This keeps the whole pipeline on permissively-licensed code paths. GIF is a
256-colour palette format, so for photographs the result may be larger than
the source โ FitImage reports the size delta either way. See NOTICE
for the full licensing posture, and docs/MAINTAINING.md
for the architecture.
git clone https://github.com/ECgear/FitImage.git
cd FitImage
npm install
npm testContributions welcome โ see CONTRIBUTING.md and CODE_OF_CONDUCT.md.
MIT ยฉ ECgear
Inspired by Google's Squoosh. FitImage does not use Squoosh's code; it is an independent tool built on sharp, libvips and mozjpeg. Thanks to those projects.
Disclaimer: FitImage is not affiliated with, endorsed by, or derived from Google or the Squoosh project. It is an independent reimplementation built on sharp and contains no Squoosh code. All product and library names are the property of their respective owners.