
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
@phantasm0009/image-zen
Advanced tools
Local-first image optimizer with AI-powered background removal, upscaling, and compression - no cloud dependencies
Local-first image optimizer with AI-powered processing - no cloud dependencies
| Feature | Technology | Performance |
|---|---|---|
| Background Removal | TensorFlow Lite + RobustVideoMatting | ~800ms avg |
| Super-resolution | TensorFlow Lite + EDSR models | ~1.2s avg |
| Smart Compression | Squoosh + multiple codecs | ~300ms avg |
| Format Conversion | Support for JPG, PNG, WebP, AVIF | ~200ms avg |
# Install globally for CLI usage
npm install -g @phantasm0009/image-zen
# Or install locally for API usage
npm install @phantasm0009/image-zen
Note: On first install, TensorFlow Lite models (~17MB total) will be downloaded automatically for offline AI processing.
# Remove background from image
image-zen remove-bg photo.jpg -o clean.png
# Upscale image 2x with AI
image-zen upscale small.jpg --scale 2 -o large.png
# Compress with Squoosh optimization
image-zen compress *.jpg --quality 80 --format webp
# Enhanced pipeline processing
image-zen enhance photo.jpg -t remove-bg,upscale,compress -s 2 -q 85
import { ImageZen, compress, removeBackground } from '@phantasm0009/image-zen';
// Create instance
const zen = new ImageZen({ verbose: true });
// AI background removal with TensorFlow Lite
const bgRemoved = await zen.removeBackground('photo.jpg');
// AI upscaling with EDSR models
const upscaled = await zen.upscale('small.jpg', 2);
// Squoosh compression
const compressed = await zen.compress('large.jpg', {
quality: 80,
format: 'webp'
});
// Enhanced pipeline
await zen.enhance('input.jpg', {
tasks: ['remove-bg', 'upscale', 'compress'],
scale: 2,
compression: { quality: 85, format: 'webp' },
output: 'output.webp'
});
// Direct function usage
const result = await compress('image.jpg', { quality: 70 });
remove-bg <input>AI-powered background removal using TensorFlow Lite
image-zen remove-bg photo.jpg -o clean.png -f png
Options:
-o, --output <path> - Output path or directory-f, --format <format> - Output format (png, webp) [default: png]upscale <input>AI super-resolution using EDSR TensorFlow Lite models
image-zen upscale small.jpg -s 4 -o large.png
Options:
-s, --scale <number> - Scale factor (2, 4) [default: 2]-o, --output <path> - Output path or directory-f, --format <format> - Output format [default: png]compress <input>Smart compression using Squoosh library
image-zen compress *.jpg -q 80 -f webp -o compressed/
Options:
-q, --quality <number> - Compression quality (1-100) [default: 80]-f, --format <format> - Output format (webp, avif, mozjpeg, oxipng) [default: webp]-o, --output <path> - Output path or directoryenhance <input>Apply multiple AI enhancements in pipeline
image-zen enhance photo.jpg -t remove-bg,upscale,compress -s 2 -q 85
Options:
-t, --tasks <tasks> - Comma-separated tasks [default: compress]-s, --scale <number> - Scale factor for upscaling [default: 2]-q, --quality <number> - Compression quality [default: 80]-f, --format <format> - Output format [default: webp]-o, --output <path> - Output path or directoryinfoShow package information and model status
const zen = new ImageZen(options);
Options:
verbose (boolean) - Enable verbose loggingremoveBackground(input, options)AI background removal using TensorFlow Lite
string | Buffer - Image path or bufferObject - Processing optionsPromise<Buffer> - Processed imageupscale(input, scale, options)AI upscaling using EDSR models
string | Buffer - Image path or buffernumber - Scale factor (2 or 4)Object - Processing optionsPromise<Buffer> - Upscaled imagecompress(input, options)Smart compression using Squoosh
string | Buffer - Image path or bufferObject - Compression options
quality: number (1-100) - Compression qualityformat: string - Output format (webp, avif, mozjpeg, oxipng)progressive: boolean - Progressive encodingoptimizeForSize: boolean - Size optimizationeffort: number (0-6) - Compression effortPromise<Buffer> - Compressed imageenhance(input, config)Enhanced processing pipeline
string | Buffer - Image path or bufferObject - Processing configuration
tasks: Array - Processing tasksoutput: string - Output file pathscale: number - Upscaling factorcompression: Object - Compression optionsPromise<Buffer | string> - Result or output pathconst zen = new ImageZen({ verbose: true });
// High-quality background removal
const result = await zen.removeBackground('portrait.jpg', {
format: 'png' // Preserve transparency
});
await fs.writeFile('portrait_clean.png', result);
// 4x upscaling with AI enhancement
const upscaled = await zen.upscale('low_res.jpg', 4, {
algorithm: 'lanczos3', // Fallback if TFLite model unavailable
sharpen: true,
enhanceDetails: true
});
// Multi-format optimization
const formats = ['webp', 'avif', 'mozjpeg'];
for (const format of formats) {
const compressed = await zen.compress('photo.jpg', {
format,
quality: await zen.getOptimalQuality('photo.jpg', format),
optimizeForSize: true
});
await fs.writeFile(`photo.${format}`, compressed);
}
const files = glob.sync('./photos/*.jpg');
const results = await zen.compressBatch(files, {
format: 'webp',
quality: 85
}, (current, total, result) => {
console.log(`Progress: ${current}/${total} - ${result.file}`);
if (result.success) {
console.log(` Saved ${result.compressionRatio}% space`);
}
});
| Operation | TensorFlow Lite | Fallback | Memory Usage |
|---|---|---|---|
| Background Removal | 800ms | 300ms | ~250MB |
| 2x Upscaling | 1.2s | 400ms | ~300MB |
| 4x Upscaling | 3.5s | 1.1s | ~600MB |
| Squoosh Compression | 300ms | - | ~150MB |
Benchmarks on M1 MacBook Pro with 16GB RAM
Models are automatically downloaded on first install:
# Check model status
image-zen info
# Manually trigger model download
npm run postinstall
# Models are stored in: node_modules/@phantasm0009/image-zen/models/
We welcome contributions! Please see our Contributing Guide for details.
MIT License - see the LICENSE file for details.
If you find this package useful, consider:
Made with ❤️ by phantasm0009 | Local-first AI for everyone
FAQs
Local-first image optimizer with AI-powered background removal, upscaling, and compression - no cloud dependencies
We found that @phantasm0009/image-zen 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
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

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