ImgByteSizer - VSCode Extension
May 9, 2026 ยท View on GitHub
A VSCode extension that integrates the imgbytesizer command-line to resize and optimize images to match specific file sizes while maintaining the best possible quality.
Requirements
- VSCode version 1.96.0 or higher
imgbytesizercommand-line tool (https://github.com/pyyupsk/imgbytesizer)
Installation
- Install the extension from the VSCode marketplace
- The extension will detect if
imgbytesizeris installed and offer to install it if needed - Alternatively, you can manually install it with:
pip install imgbytesizer
Usage
Basic Usage
- Right-click on an image file in the explorer or editor
- Select "ImgByteSizer: Resize Image to Target Size"
- Choose a target file size
- The image will be resized using default settings and saved with "_resized" suffix
Advanced Usage
- Right-click on an image file in the explorer or editor
- Select "ImgByteSizer: Resize Image with Advanced Options"
- Follow the prompts to configure:
- Target file size
- Output format
- Output path
- Minimum dimensions
- Exact size padding
Extension Settings
This extension contributes the following settings:
imgbytesizer.defaultTargetSize: Default target file size (e.g., '1MB', '500KB')imgbytesizer.defaultFormat: Default output format (same, jpg, jpeg, png, webp)imgbytesizer.defaultMinDimension: Default minimum width/height in pixels (0 to disable)imgbytesizer.defaultExact: Whether to pad file to get exact target size by defaultimgbytesizer.imgbytesizerPath: Path to the imgbytesizer executable (Leave empty to use 'imgbytesizer' as default)
How It Works
This extension is a wrapper around the imgbytesizer command-line, which:
- Analyzes the input image
- Uses binary search to find optimal quality settings
- Resizes and compresses the image to match the target file size
- Maintains the best possible quality within the size constraints
About imgbytesizer
The imgbytesizer is a command-line tool that resizes images to match a target file size while maintaining quality. It's particularly useful when you need to meet specific size requirements (like upload limits) without manually trying different compression settings.
For more information about the command-line, see the imgbytesizer documentation.
License
This project is licensed under the MIT License - see the LICENSE file for details.