Skip to content

t0ri333/low-memory-upscaler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🖼️ Low-Memory Image Upscaler

AI-powered image upscaling that works on any computer, even with just 8GB RAM

A memory-efficient Python tool for upscaling images using Real-ESRGAN AI model. Designed specifically for systems with limited RAM, enabling you to create massive, print-ready images on a MacBook Air or similar hardware.

✨ Why This Tool?

Most AI upscaling tools require 16GB+ RAM and a powerful GPU. This tool is different:

  • Works on 8GB RAM - Uses CPU processing with intelligent memory management
  • No GPU required - Runs on any computer with Python
  • Massive output - Scale small images into poster-size prints (16x upscaling)
  • Tile-based processing - Adaptive memory usage prevents crashes
  • Commercial quality - Sharpening filters and lossless TIFF output

🎯 Use Cases

  • Create large format prints from smartphone photos
  • Upscale digital art for posters and wall art
  • Prepare low-resolution images for professional printing
  • Generate high-quality images for presentations or displays

📊 What It Does

Transform your images:

Input:  1024 × 1024 pixels (1 MP)
Output: 16384 × 16384 pixels (268 MP)
Print:  ~140 × 140 cm at 300 DPI

🛠️ Installation

Prerequisites

  • Python 3.7 or higher
  • pip package manager

Install Dependencies

cd low-memory-upscaler
pip install -r requirements.txt

Note: The first run will automatically download the AI model (~67MB) from GitHub.

🚀 Quick Start

Basic Usage

Upscale an image 16x (default):

python src/upscale.py -i input.jpg -o output.tif

More Examples

4x upscaling (faster):

python src/upscale.py -i photo.jpg -o result.tif --scale 4

PNG output with 150 DPI:

python src/upscale.py -i image.jpg -o output.png --format PNG --dpi 150

Reduce tile size if you get memory errors:

python src/upscale.py -i photo.jpg -o result.tif --tile 100

Verify Quality

Check the quality of your upscaled image:

python src/verify_quality.py -i output.tif

This generates a proof sheet showing sharpness analysis at different regions.

⚙️ Options

upscale.py

Option Short Default Description
--input -i required Input image path
--output -o output.tif Output image path
--scale -s 16 Upscaling factor (2, 4, 8, or 16)
--format -f TIFF Output format (TIFF, PNG, JPEG)
--dpi 300 Output DPI for printing
--tile 200 Tile size (lower if OOM)
--no-sharpen false Disable sharpening filter

verify_quality.py

Option Short Default Description
--input -i output.tif Image to verify
--output -o quality_proof.jpg Proof sheet output
--dpi 300 Proof sheet DPI
--no-proof false Skip proof sheet generation

💡 Tips & Troubleshooting

Memory Issues

If you encounter "Out of Memory" errors:

  1. Reduce tile size: --tile 100 or even --tile 50
  2. Use lower scaling: --scale 4 instead of --scale 16
  3. Close other applications while processing

Processing Time

  • 4x scaling: ~10-20 minutes on 8GB RAM
  • 16x scaling: ~40-90 minutes on 8GB RAM
  • Plug in your laptop to prevent sleep during processing

Best Quality

  • Use TIFF format for lossless quality
  • 300 DPI for standard prints, 150 DPI for very large posters
  • The built-in sharpening improves perceived sharpness
  • Run verify_quality.py to check results before printing

Output Size Considerations

A 16x upscaled image can be:

  • File size: 400-600 MB (TIFF with compression)
  • Dimensions: 16000+ pixels on each side
  • Print size: 1+ meters at 150 DPI

🔍 How It Works

  1. CPU Processing: Uses CPU instead of GPU to leverage virtual memory
  2. Tile-Based Upscaling: Processes image in small tiles to manage memory
  3. Multi-Stage Scaling: Breaks large scaling into smaller steps (e.g., 4x → 16x)
  4. Memory Cleanup: Aggressively frees memory between stages
  5. Post-Processing: Applies sharpening filters to enhance edge clarity

📦 AI Model

Uses Real-ESRGAN (Real-World Electronic Scene Image Super-Resolution):

  • State-of-the-art AI super-resolution model
  • Trained on real-world images (not synthetic data)
  • Excellent at adding realistic details and textures
  • Automatically downloaded on first run

📄 License

MIT License - feel free to use in personal or commercial projects.

🤝 Contributing

This tool was developed to solve the specific problem of upscaling images on hardware-constrained systems. If you find it useful, consider:

  • Reporting bugs or issues
  • Sharing your use cases
  • Suggesting improvements

🙏 Acknowledgments


Made with ❤️ for small-RAM computers everywhere

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages