Creating a Cooking Image Collage | Generated by AI

Home 2026.06

Here’s how I did it, step by step:

1. Source Material Discovery

Read original/2024-12-29-cooking-en.md and found images in two directories:

2. Image Selection (9 images, 3 categories)

Picked 9 images for diversity:

3. Image Merging — ImageMagick montage

The key tool is ImageMagick’s montage command. Two stages:

Stage A — Resize all 9 to uniform 400x400:

for img in cooking1.jpg cooking2.jpg cooking4.jpg porridge1.jpg porridge2.jpg porridge3.jpg s1.jpg s3.jpg s5.jpg; do
  magick "$img" -resize 400x400^ -gravity center -extent 400x400 "/tmp/cooking_tiles/$name"
done

Stage B — Combine into 3x3 grid:

magick montage \
  tile1.jpg tile2.jpg ... tile9.jpg \
  -tile 3x3 -geometry 400x400+4+4 -background white \
  cooking_collage.jpg

Why two stages? The montage geometry parameter doesn’t reliably resize source images on this ImageMagick build (the “Freetype delegate” warning). Pre-resizing guarantees uniform tiles.

4. Compression

The raw collage was 595KB — over the 500KB pre-commit limit. Fixed with:

magick cooking_collage.jpg -quality 80 cooking_collage.jpg

Result: 359KB, passes the check.

5. Writing the Section

Added to the portfolio between “Passed Courses” and “What’s Next” — a concise section covering:

Summary of Tools Used

Step Tool Command
Resize ImageMagick magick -resize 400x400^ -gravity center -extent 400x400
Combine ImageMagick montage -tile 3x3 -geometry 400x400+4+4
Compress ImageMagick magick -quality 80
Edit patch tool find-and-replace in the .md file
Git gh CLI commit, push, gh workflow run

Back Donate