Transform images with AI-powered editing

You have a batch of images that need AI-powered transformations—like turning photos into paintings, adding stylistic effects, or modifying content based on text prompts.

Images · Notebook · Updated

Colab runs it in your browser. If it calls a model provider, it asks for that provider's API key in a cell.

How it works

You can iterate on transformations before adding them to your table. Use .select() with .collect() to preview results on sample images—nothing is stored in your table. If you want to collect only the first few rows, use .head(n) instead of .collect(). Once you're satisfied, use .add_computed_column() to apply the transformation to all images in your table.

For more on this workflow, see Get fast feedback on transformations.

What it covers

  • Transform images using text prompts with Hugging Face Stable Diffusion models
  • Control transformation strength and quality settings
  • Process batches of images automatically

What it uses

Install
terminal
pip install pixeltable torch transformers diffusers accelerate
Pixeltable calls
huggingface.image_to_image()pxt.create_table()insert()add_computed_column()

A look at the code

img-image-to-image.ipynb
# Save as computed column
t.add_computed_column(
transformed=image_to_image(
t.image,
t.prompt,
model_id='stable-diffusion-v1-5/stable-diffusion-v1-5',
model_kwargs={
'strength': 0.5,
'num_inference_steps': 25,
'negative_prompt': t.negative_prompt,
},
)
)

One cell of the notebook, copied as it is. Open it in Colab for the rest.

Browse all 103