Skip to content

ECgear/FitImage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FitImage

็”ปๅƒใ‚’ใพใจใ‚ใฆ**่ปฝใ๏ผˆใƒ•ใ‚กใ‚คใƒซใ‚ตใ‚คใ‚บใ‚’ๅฐใ•ใ๏ผ‰**ใงใใ‚‹ใƒ„ใƒผใƒซใงใ™ใ€‚่ณชๅ•ใซ็ญ”ใˆใ‚‹ใ ใ‘ใง JPG / WebP / PNG / GIF ใธใฎๅค‰ๆ›ใƒปๅœง็ธฎใŒใงใใพใ™ใ€‚็”ปๅƒ็ทจ้›†ใฎ็Ÿฅ่ญ˜ใฏไธ่ฆใ€‚ macOS / Windows / Linux ใงๅŒใ˜ใ‚ˆใ†ใซๅ‹•ใใพใ™ใ€‚Powered by sharp.

CI License: MIT Node

๐Ÿ‡ฌ๐Ÿ‡ง 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๏ผ‰ใ€ใŒใ‚ใ‚Šใพใ™ โ†’ ๅ…ƒใฎ็”ปๅƒใฏๆถˆใˆใพใ›ใ‚“ใ‹๏ผŸ

ใฏใ˜ใ‚ใ‹ใŸ๏ผˆ้ †็•ชใซใ‚„ใ‚ŒใฐOK๏ผ‰

ๆ‰‹้ †1ใจ2ใฏๆœ€ๅˆใฎไธ€ๅบฆใ ใ‘ใ€‚ๆฌกๅ›žใ‹ใ‚‰ใฏๆ‰‹้ †3ใƒป4ใ ใ‘ใงใ™ใ€‚

ๆ‰‹้ †1 โ€” Node.js ใ‚’ๅ…ฅใ‚Œใ‚‹๏ผˆๆœ€ๅˆใฎไธ€ๅบฆใ ใ‘๏ผ‰

FitImage ใฏ Node.js ใจใ„ใ†็„กๆ–™ใƒ„ใƒผใƒซใฎไธŠใงๅ‹•ใใพใ™ใ€‚

  1. https://nodejs.org/ ใ‚’้–‹ใ
  2. ็ท‘่‰ฒใฎๅคงใใช ใ€ŒLTSใ€ ใƒœใ‚ฟใƒณใ‹ใ‚‰ใƒ€ใ‚ฆใƒณใƒญใƒผใƒ‰ใ—ใฆใ€ใ‚คใƒณใ‚นใƒˆใƒผใƒฉใƒผใ‚’ๅฎŸ่กŒ
  3. ใ€Œๆฌกใธ / ็ถšใ‘ใ‚‹ใ€ใ‚’ๆŠผใ—ใฆใ„ใใ ใ‘๏ผˆๅˆๆœŸ่จญๅฎšใฎใพใพใงOK๏ผ‰

็ขบ่ชใ™ใ‚‹ใซใฏใ€ใ‚ฟใƒผใƒŸใƒŠใƒซ๏ผˆโ†’ๆ‰‹้ †3๏ผ‰ใงใ“ใ†ๅ…ฅๅŠ›ใ—ใพใ™๏ผš

node -v

v20.11.1 ใฎใ‚ˆใ†ใชๆ•ฐๅญ—ใŒๅ‡บใ‚Œใฐๆบ–ๅ‚™ๅฎŒไบ†ใงใ™๏ผˆ18ไปฅไธŠใชใ‚‰OK๏ผ‰ใ€‚

ๆ‰‹้ †2 โ€” FitImage ใ‚’ๅ…ฅใ‚Œใ‚‹๏ผˆๆœ€ๅˆใฎไธ€ๅบฆใ ใ‘๏ผ‰

ใ‚ฟใƒผใƒŸใƒŠใƒซใงๆฌกใ‚’ๅ…ฅๅŠ›ใ—ใฆ Enter๏ผš

npm install -g @ecgear/fitimage

ๅ…ฅใฃใŸใ‹็ขบ่ช๏ผš

fitimage --version

ๆ•ฐๅญ—ใŒๅ‡บใ‚ŒใฐๅฎŒไบ†ใงใ™ใ€‚๐ŸŽ‰

๐Ÿ’ก ใ‚คใƒณใ‚นใƒˆใƒผใƒซใ—ใŸใใชใ„ๅ ดๅˆใฏใ€npx @ecgear/fitimage ใงใ‚‚ใใฎ้ƒฝๅบฆๅฎŸ่กŒใงใใพใ™ ๏ผˆ่ตทๅ‹•ใฏๅฐ‘ใ—้…ใ„ใงใ™ใŒใ€ๆบ–ๅ‚™ไธ่ฆใงใ™๏ผ‰ใ€‚

ๆ‰‹้ †3 โ€” ใ‚ฟใƒผใƒŸใƒŠใƒซใ‚’้–‹ใ

ใ€Œใ‚ฟใƒผใƒŸใƒŠใƒซใ€ใฏใ‚ณใƒžใƒณใƒ‰ใ‚’ๅ…ฅๅŠ›ใ™ใ‚‹็ช“ใงใ™ใ€‚

  • macOS โ€ฆ โŒ˜+Space โ†’ใ€Œใ‚ฟใƒผใƒŸใƒŠใƒซใ€ใจๅ…ฅๅŠ›ใ—ใฆ Enter
  • Windows โ€ฆ โŠž(Windows)ใ‚ญใƒผ โ†’ใ€Œใ‚ฟใƒผใƒŸใƒŠใƒซใ€ใพใŸใฏใ€ŒPowerShellใ€ใจๅ…ฅๅŠ›ใ—ใฆ Enter
  • Linux โ€ฆ ใ‚ขใƒ—ใƒชไธ€่ฆงใ‹ใ‚‰ใ€Œ็ซฏๆœซ๏ผTerminalใ€ใ‚’้–‹ใ

ๆ‰‹้ †4 โ€” ๅฎŸ่กŒใ—ใฆ่ณชๅ•ใซ็ญ”ใˆใ‚‹

ๆฌกใ‚’ๅ…ฅๅŠ›ใ—ใฆ 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
  1. ใ€ŒAdd / update a right-click menu entryใ€๏ผˆ่ฟฝๅŠ ใƒปๆ›ดๆ–ฐ๏ผ‰ใ‚’้ธใณใพใ™ใ€‚
  2. ใƒกใƒ‹ใƒฅใƒผๅ๏ผˆใƒฉใƒ™ใƒซ๏ผ‰ ใ‚’ๅ…ฅๅŠ›ใ—ใพใ™ใ€‚ใ“ใ“ใงๅ…ฅๅŠ›ใ—ใŸๅๅ‰ใŒใ€ๅณใ‚ฏใƒชใƒƒใ‚ฏ ใƒกใƒ‹ใƒฅใƒผใซใใฎใพใพ่กจ็คบใ•ใ‚Œใพใ™๏ผˆไพ‹๏ผšWebPใซๅค‰ๆ›๏ผ‰ใ€‚
  3. ใ“ใ‚ŒใงๅฎŒไบ†ใงใ™ใ€‚็”ปๅƒใ‚„ใƒ•ใ‚ฉใƒซใƒ€ใ‚’ๅณใ‚ฏใƒชใƒƒใ‚ฏใ—ใฆใ€ใใฎๅๅ‰ใ‚’้ธในใฐๅฎŸ่กŒใงใใพใ™ใ€‚

่ค‡ๆ•ฐใฎๆ“ไฝœใ‚’็™ป้Œฒใ™ใ‚‹

ใƒฉใƒ™ใƒซใ‚’ๅค‰ใˆใ‚Œใฐใ€ใ„ใใคใงใ‚‚่ฟฝๅŠ ใงใใพใ™๏ผˆๆœ€ๅคง 10 ๅ€‹๏ผ‰ใ€‚ ไพ‹ใˆใฐใ€ŒJPGใซๅœง็ธฎใ€ใจ ใ€ŒWebPใซๅค‰ๆ›ใ€ใ‚’ๅˆฅใ€…ใซ็™ป้Œฒใ—ใฆใŠใ‘ใฐใ€ๅณใ‚ฏใƒชใƒƒใ‚ฏใƒกใƒ‹ใƒฅใƒผใ‹ใ‚‰็”จ้€”ใซๅฟœใ˜ใฆ้ธในใพใ™ใ€‚

  • ๅˆฅใฎๅๅ‰ใง็™ป้Œฒใ™ใ‚‹ใจใ€ๆ–ฐใ—ใ„้ …็›ฎใจใ—ใฆ ่ฟฝๅŠ  ใ•ใ‚Œใพใ™ใ€‚
  • ๅŒใ˜ๅๅ‰ใง็™ป้Œฒใ—็›ดใ™ใจใ€ใใฎ้ …็›ฎใŒ ๆ›ดๆ–ฐ ใ•ใ‚Œใพใ™๏ผˆ่จญๅฎšใ‚’ๅค‰ใˆใŸใ„ใจใ๏ผ‰ใ€‚

ๅ‰Š้™คใ™ใ‚‹ใซใฏ

ใ‚‚ใ†ไธ€ๅบฆ fitimage --install-menu ใ‚’ๅฎŸ่กŒใ—ใฆใ€

  1. ใ€ŒRemove a right-click menu entryใ€๏ผˆๅ‰Š้™ค๏ผ‰ใ‚’้ธใณใพใ™ใ€‚
  2. ็™ป้Œฒๆธˆใฟใฎไธ€่ฆงใŒ่กจ็คบใ•ใ‚Œใ‚‹ใฎใงใ€ๅ‰Š้™คใ—ใŸใ„้ …็›ฎ ใ‚’้ธใณใพใ™ใ€‚ ใ™ในใฆๆถˆใ—ใŸใ„ใจใใฏ ใ€ŒAll FitImage entriesใ€๏ผˆใ™ในใฆๅ‰Š้™ค๏ผ‰ใ‚’้ธใณใพใ™ใ€‚

๐Ÿ’ก ๅผ•ๆ•ฐใชใ—ใฎ fitimage --install-menu ใ ใ‘ใงใ‚‚ใ‚คใƒณใ‚นใƒˆใƒผใƒฉใฏ่ตทๅ‹•ใ—ใพใ™ ๏ผˆๅ‰Š้™คใ‚„ไธ€่ฆงใฎ็ขบ่ชใ ใ‘ใ—ใŸใ„ใจใใซไพฟๅˆฉใงใ™๏ผ‰ใ€‚

ๅ„ OS ใงใฎๅ‹•ไฝœ

  • macOS โ€ฆ ~/Library/Services ใซ Automator ใฎใ‚ฏใ‚คใƒƒใ‚ฏใ‚ขใ‚ฏใ‚ทใƒงใƒณใ‚’ไฝœๆˆ ใ—ใพใ™๏ผˆๅณใ‚ฏใƒชใƒƒใ‚ฏ โ†’ใ€Œใ‚ฏใ‚คใƒƒใ‚ฏใ‚ขใ‚ฏใ‚ทใƒงใƒณใ€๏ผ‰ใ€‚็ฎก็†่€…ๆจฉ้™ใฏไธ่ฆใงใ™ใ€‚
  • Windows โ€ฆ ็”ปๅƒใƒ•ใ‚กใ‚คใƒซใจใƒ•ใ‚ฉใƒซใƒ€ๅ‘ใ‘ใซใƒฆใƒผใ‚ถใƒผๅ˜ไฝใฎใƒฌใ‚ธใ‚นใƒˆใƒช้ …็›ฎใ‚’่ฟฝๅŠ ใ—ใ€ ๅฐใ•ใช VBScript ็ตŒ็”ฑใงใ‚ฆใ‚ฃใƒณใƒ‰ใ‚ฆใ‚’ๅ‡บใ•ใšใซๅฎŸ่กŒใ—ใพใ™ใ€‚Windows 11 ใงใฏ ใ€Œใใฎไป–ใฎใ‚ชใƒ—ใ‚ทใƒงใƒณใ‚’่กจ็คบใ€ใฎไธญใซๅ‡บใ‚‹ใ“ใจใŒใ‚ใ‚Šใพใ™ใ€‚็ฎก็†่€…ๆจฉ้™ใฏไธ่ฆใงใ™ใ€‚

โš ๏ธ ใƒกใƒ‹ใƒฅใƒผใซใฏ ็™ป้Œฒใ—ใŸๆ™‚็‚นใฎ Node.js ใฎๅ ดๆ‰€ ใŒ่จ˜้Œฒใ•ใ‚Œใพใ™ใ€‚Node ใ‚’ๅ…ฅใ‚Œ็›ดใ™ใจ ใƒกใƒ‹ใƒฅใƒผใŒๅ‹•ใ‹ใชใใชใ‚‹ใ“ใจใŒใ‚ใ‚Šใพใ™ใ€‚ใใฎๅ ดๅˆใฏ Add / update ใงๅŒใ˜ใƒฉใƒ™ใƒซใ‚’ ้ธใณใ€ไฝœใ‚Š็›ดใ—ใฆใใ ใ•ใ„ใ€‚

่ฉณใ—ใ„ไฝฟใ„ๆ–น๏ผˆใ‚ณใƒžใƒณใƒ‰ใฎใ‚ชใƒ—ใ‚ทใƒงใƒณใƒปใƒ—ใƒญใ‚ฐใƒฉใƒ ใ‹ใ‚‰ใฎๅˆฉ็”จใƒปใƒฉใ‚คใ‚ปใƒณใ‚น๏ผ‰ใฏใ€ไธ‹ใฎ English ใ‚ปใ‚ฏใ‚ทใƒงใƒณใซใพใจใ‚ใฆใ„ใพใ™ใ€‚


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.

๐Ÿ‡ฏ๐Ÿ‡ต ๆ—ฅๆœฌ่ชžใฎใ‚ฌใ‚คใƒ‰ใฏใ“ใฎใƒšใƒผใ‚ธไธŠ้ƒจใซใ‚ใ‚Šใพใ™ โ†’ ๆ—ฅๆœฌ่ชž๏ผˆใฏใ˜ใ‚ใฆใฎๆ–นใธ๏ผ‰โ†‘.

What is FitImage?

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?

Getting started (step by step)

You only do Steps 1 and 2 once. After that, using FitImage is just Step 3 + 4.

Step 1 โ€” Install Node.js (one time)

FitImage runs on a free tool called Node.js.

  1. Go to https://nodejs.org/
  2. Download the big green โ€œLTSโ€ button and run the installer.
  3. Click Next / Continue through the installer (the defaults are fine).

To check it worked, open a terminal (see Step 3) and type:

node -v

If you see a version number like v20.11.1, you're ready. (Any number 18 or higher is fine.)

Step 2 โ€” Install FitImage (one time)

In the terminal, type this and press Enter:

npm install -g @ecgear/fitimage

Check it installed:

fitimage --version

If you see a version number, you're done. ๐ŸŽ‰

๐Ÿ’ก Don't want to install anything? You can also run FitImage on demand with npx @ecgear/fitimage instead of installing it. It's a little slower to start but needs no setup.

Step 3 โ€” Open a terminal

The "terminal" is a window where you type commands.

  • macOS โ€” Press โŒ˜ Command + Space, type Terminal, press Enter.
  • Windows โ€” Press the โŠž Windows key, type Terminal (or PowerShell), press Enter.
  • Linux โ€” Open your Terminal app from the applications menu.

Step 4 โ€” Run FitImage and follow the questions

Type this and press Enter:

fitimage

FitImage 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.

One-Shot Command โ€” repeat a run in one step

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

Next 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 npx instead of installing it, prefix the command with npx @ecgear/fitimage.
  • See the Options table below for what each flag means.
How do I type the folder path?

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).

Will it ruin my originals?

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.

Which format should I choose?

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? .gif files 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.)

Frequently asked questions

โ€œ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.

Command-line usage (for advanced users / scripting)

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-run to preview, or --prefix/--suffix/--out to keep originals.

Options

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.

Right-click menu (--install-menu)

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
  1. Choose "Add / update a right-click menu entry."
  2. Type a menu label โ€” the name you type is exactly what appears in the right-click menu (e.g. Convert to WebP).
  3. 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:

  1. Choose "Remove a right-click menu entry."
  2. 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_USER registry 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.

Programmatic API

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' } });

How it works

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.

Development

git clone https://github.com/ECgear/FitImage.git
cd FitImage
npm install
npm test

Contributions welcome โ€” see CONTRIBUTING.md and CODE_OF_CONDUCT.md.

License

MIT ยฉ ECgear

Credits

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.

About

Cross-platform batch image compressor (WebP to JPG + JPEG/PNG compression), powered by sharp

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors