| --- |
| title: CanvasAI |
| emoji: π |
| colorFrom: red |
| colorTo: indigo |
| sdk: gradio |
| sdk_version: 6.22.0 |
| python_version: '3.12' |
| app_file: app.py |
| pinned: false |
| short_description: AI Image Enhancer, Colourizer and Outpainter |
| startup_duration_timeout: 1h |
| --- |
| |
| # CanvasAI |
|
|
| Three AI image tools in one interface β upscale and sharpen any photo, colorize black and white images automatically, or extend a scene beyond its original borders. |
|
|
| --- |
|
|
| ## Tools |
|
|
| ### β¨ Enhancement |
| Real-ESRGAN upscales images 2Γ or 4Γ, reconstructing fine detail rather than stretching pixels. Processes large images in tiles to stay within VRAM limits. |
|
|
| ### π¨ Colorization |
| DDColor adds natural color to black and white images without changing structure or composition. Post-processed with LAB color space smoothing to reduce color patchiness, and a saturation boost to compensate for DDColor's tendency to under-saturate. Fully automatic β no prompt needed. |
|
|
| ### π² Outpainting |
| Extends your image in any direction using Stable Diffusion 2 Inpainting. BLIP reads the image and generates an appropriate prompt automatically. Uses a multi-pass 64px incremental approach with feathered mask blending for coherent results. |
|
|
| --- |
|
|
| ## How the Outpainting Works |
|
|
| The pipeline extends 64 pixels at a time rather than all at once. Each small pass gives SD 87%+ original image context β SD extrapolates naturally from what it can see. One large extension gives SD only 60-70% context, and the generated content becomes incoherent. |
|
|
| The mask uses GaussianBlur feathering so the boundary between original and generated content is a soft gradient rather than a hard cut. The mask is resized with LANCZOS (not NEAREST) to preserve this gradient when scaling to SD's 768Γ768 input size. |
|
|
| --- |
|
|
| ## Honest Limitations |
|
|
| **Enhancement** does not deblur. It upscales and sharpens existing detail. Blurry input produces larger blurry output. |
|
|
| **Colorization** works well on portraits, street scenes, and landscapes. Complex fabric patterns and heavily degraded photographs may produce inconsistent colors. Results will not match commercial colorization tools. |
|
|
| **Outpainting** quality varies by input. Works best on simple consistent backgrounds at 25% extension or below. Struggles with complex foreground subjects near edges and high extension percentages. The multi-pass approach significantly improves over single-pass but does not eliminate the underlying model's limitations. |
|
|
| --- |
|
|
| ## Tips for Best Results |
|
|
| - Enhancement: works on any image, best on photographs with existing sharp detail |
| - Colorization: portraits and outdoor scenes colorize most consistently |
| - Outpainting: use Horizontal or Vertical (not Both), keep extension at 25%, use the custom prompt field if BLIP misreads your image |
|
|
| --- |
|
|
| ## Models Used |
|
|
| | Model | Purpose | |
| |---|---| |
| | RealESRGAN_x4plus | Super resolution | |
| | stable-diffusion-2-inpainting | Scene extension | |
| | blip-image-captioning-base | Auto prompt generation | |
| | cv_ddcolor_image-colorization | B&W colorization | |
| |
| --- |
| |
| ## Privacy |
| |
| Images are processed in memory and not stored permanently. Uploaded images are deleted when your session ends. Do not upload sensitive or private images. |
| |
| --- |
| |
| ## GitHub |
| |
| Full code, architecture notes, and documentation: |
| [github.com/Mohit485/CanvasAI](https://github.com/Mohit485/CanvasAI) |