Compress images in place, right from your editor.
Lossy, TinyPNG-class image compression — without the round-trip. Right-click an image in the Explorer and it’s re-encoded on the spot. Everything runs locally; your images never leave your machine.
Live demo — runs entirely in your browser
Right-click any image in the tree
Loading samples… Optimize Image to compress it in place, or Preview… for the quality slider. Everything runs in your browser — nothing is uploaded.
What it does
Six formats
JPEG, PNG, WebP, AVIF, TIFF, and GIF — mozjpeg for JPEG, libimagequant palette quantization for PNG, plus modern WebP and AVIF.
Right from the Explorer
Right-click an image, a multi-selection, or a whole folder. Folders recurse and optimize every supported image inside.
Live quality preview
A quality slider with a side-by-side before/after and real-time size and savings — re-encoded as you drag.
Smart skip rules
Keep the original when there’s no size win, or only overwrite when savings clear a threshold you set.
Optimize As…Coming soon
Re-encode a single image to a new name or a different format, bypassing the skip rules when you ask for it explicitly.
100% local
Images never leave your machine — no upload, no service, no round-trip. The encoder runs in-process via sharp.
Install & use
1. Install
Install from the open-source GitHub repo:
git clone https://github.com/john-rock/vscimg.git
cd vscimg
npm install
npm run package
code --install-extension image-optimizer-*.vsixOr download a .vsix from GitHub Releases and in VS Code choose Extensions → Install from VSIX....
Also coming soon to the VS Code Marketplace.
2. Run a command
Right-click in the Explorer, or open the Command Palette:
Optimize Image — re-encode & overwrite in place (file, selection, or folder)
Optimize Image: Preview — open the quality slider before saving
Optimize Image As… — re-encode to a new name or format3. Tune it (settings.json)
Per-format quality and skip rules:
{
"imageOptimizer.jpegQuality": 80,
"imageOptimizer.pngQuality": 80,
"imageOptimizer.webpQuality": 80,
"imageOptimizer.skipIfLargerOrEqual": true,
"imageOptimizer.minSavingsPercent": 0,
"imageOptimizer.notificationSeconds": 5
}How it works
In the editor the encoder is sharp: mozjpeg for JPEG, libimagequant palette quantization for PNG (the lossy step that gives TinyPNG-class savings), plus WebP, AVIF, TIFF and GIF.
It runs in-process, so files are re-encoded locally and overwritten in place — no service, no upload.