Surprise Me!

Free AI Image-to-Image: Running Stable Diffusion on Google Colab

2026-05-18 39 Dailymotion

Don't have a powerful local GPU? You can still use the advanced "Image-to-Image" (img2img) capabilities of Stable Diffusion for free using Google Colab.

In this tutorial, I show you how to set up an img2img workflow in Colab, from connecting to a T4 GPU instance to uploading your source images and applying changes via prompts. Whether you want to turn sketches into realistic art, change clothing colors, or alter expressions, this guide walks you through the settings—including the critical "denoising strength"—to help you get the best results without needing high-end hardware.

Google Colab: https://colab.research.google.com/
Script Code1:
!pip install diffusers["torch"] transformers
!pip install accelerate
!pip install git+https://github.com/huggingface/diffusers

Script Code2:
import torch
from diffusers import AutoPipelineForImage2Image
from diffusers.utils import load_image, make_image_grid


init_image = load_image("/content/9.png")
mymodel = "digiplay/Realisian_v5"
myprompt="Cat Head, male"
mynegative_prompt = ""
myheight=512
mywidth=768
mysteps=25
myguidance_scale = 7.5
mystrength=0.7

pipeline = AutoPipelineForImage2Image.from_pretrained(
mymodel, torch_dtype=torch.float16, variant="fp16", use_safetensors=True
).to("cuda")
pipeline.safety_checker = None

image1 = pipeline(
prompt=myprompt,
image=init_image,
negative_prompt=mynegative_prompt,
height=myheight, width=mywidth,
num_inference_step=mysteps,
guidance_scale = myguidance_scale,
strength=mystrength,
).images[0]
image1
make_image_grid([init_image, image1], rows=1, cols=2)

How to do text 2 image stable diffusion in Google Colab: https://www.dailymotion.com/video/xa7wtw2

Original YouTube Tutorial: https://youtu.be/tWdYwuFryFs

Video Details:
* Original Publish Date: March 27, 2024
* Focus: Image-to-Image / Google Colab / Stable Diffusion Workflow
* Test using RTX 4060 TI 16 GB of VRAM

Follow lordcaocao2025 on Dailymotion for more technical AI research and generative workflow guides!

---
Connect with me:
📺 YouTube: https://www.youtube.com/@CaoCao2025
📱 TikTok: https://www.tiktok.com/@caocao20250
💎 Patreon: https://www.patreon.com/cw/Caocao2025

#StableDiffusion #GoogleColab #img2img #AIArt #FreeTools #AITutorial #lordcaocao2025