A browser extension that colorizes grayscale and black & white images using AI. The extension communicates with a local Python server that processes images using machine learning models.
- Right-click on any image to colorize it
- In-place image replacement with colorized version
- Toggle button to switch between original and colorized images
- Works on any website
- Local processing via Python server
The solution consists of two components:
- Browser Extension (Manifest V3) - Detects images, sends them to server, displays results
- Python Server (Flask) - Receives images, colorizes using ML model, returns results
This is the easiest way to get started and avoids platform-specific dependency issues.
-
Prerequisites: Install Docker and Docker Compose
-
Build and run the container:
docker-compose up --buildThe server will start on http://localhost:3000. The first run will:
- Download all dependencies
- Clone the DeOldify repository
- Download the pre-trained model (~1.4GB) on first colorization request
- Stop the server:
docker-compose downNote: The model file will be persisted in server/DeOldify/models/ so you don't need to re-download it on subsequent runs.
GPU Support (Optional): If you have an NVIDIA GPU and want to use it for faster processing:
- Install NVIDIA Container Toolkit
- Uncomment the GPU section in
docker-compose.yml - Rebuild:
docker-compose up --build
- Navigate to the server directory:
cd server- Install Python dependencies:
pip install -r requirements.txt-
Install DeOldify (choose one method):
- Windows: Run
install_deoldify.batorinstall_deoldify.ps1 - macOS/Linux: Run
./install_deoldify.sh - Manual:
git clone https://github.com/jantic/DeOldify.git server/DeOldify
- Windows: Run
-
Download the model (optional - will auto-download on first run):
python download_model.py- Start the server:
python app.pyThe server will start on http://localhost:3000
-
Open your browser's extension management page:
- Chrome/Edge:
chrome://extensions/oredge://extensions/ - Firefox:
about:addons(Note: Firefox uses Manifest V2, may need adjustments)
- Chrome/Edge:
-
Enable "Developer mode"
-
Click "Load unpacked" and select the
extensionfolder -
Important: Create icon files in
extension/icons/:icon16.png(16x16 pixels)icon48.png(48x48 pixels)icon128.png(128x128 pixels)
You can use any PNG images with these dimensions as placeholders.
-
Make sure the Python server is running:
- Docker:
docker-compose up(or already running in background) - Manual:
python server/app.py
- Docker:
-
Navigate to any webpage with images
-
Right-click on a grayscale or black & white image
-
Select "Colorize Image" from the context menu
-
Wait for the image to be processed (a loading indicator will appear)
-
The image will be replaced with the colorized version
-
Click the "Show Original" button to toggle between original and colorized versions
This project uses DeOldify for high-quality image colorization. DeOldify is already integrated and configured:
- Docker setup: DeOldify is automatically installed and configured
- Manual setup: Follow the installation instructions in
server/README.md
The DeOldify model provides state-of-the-art colorization results for grayscale and black & white images.
image-colorizer/
├── extension/
│ ├── manifest.json # Extension configuration
│ ├── background.js # Service worker for context menu
│ ├── content.js # Image processing and UI injection
│ ├── popup.html # Extension popup UI
│ ├── popup.js # Popup functionality
│ ├── styles.css # Styling for toggle controls
│ └── icons/ # Extension icons (create these)
│ ├── icon16.png
│ ├── icon48.png
│ └── icon128.png
├── server/
│ ├── app.py # Flask server application
│ ├── colorizer.py # Image colorization logic
│ ├── requirements.txt # Python dependencies
│ └── README.md # Server-specific documentation
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose configuration
└── README.md # This file
- Make sure the Python server is running on
localhost:3000 - Check the extension popup for server connection status
- Verify firewall settings allow localhost connections
- Check browser console for errors (F12)
- Verify the image is accessible (not blocked by CORS)
- Check server logs for processing errors
- Ensure image size is under 10MB (client limit) and 20MB (server limit)
- Reload the extension in browser extension management
- Check that you're using a Manifest V3 compatible browser (Chrome 88+, Edge 88+)
- Verify all permissions are granted
- Images are limited to 10MB on client side, 20MB on server side
- Large images may take time to process (especially on CPU)
- Server must be running locally
- First model download is ~1.4GB
- GPU recommended for faster processing
- Start the server:
- Docker:
docker-compose up - Manual:
python server/app.py
- Docker:
- Load the extension in your browser
- Test on various websites with grayscale images
- Check browser console (F12) for any errors
- Edit files in
server/directory - Docker: Rebuild with
docker-compose up --build - Manual: Restart the server
This project is open source. Feel free to modify and use as needed.