Sub topic 11
Finishing touches outside the generator
This chapter assumes you can run a short Python script with Pillow installed. It also assumes you know your channel sizes from the earlier chapter. A generator gives you a good starting image. A finishing pass turns it into an asset you can publish.
Why finish elsewhere
Re-prompting the generator to fix small problems is slow, and it can change parts of the image you already liked. Ordinary editing tools are deterministic. The same operation on the same file gives the same result every time. Use the generator for content and an editor for polish.
Typical finishing jobs:
- Fix small defects, such as a stray object or an odd edge. Use an editor's healing or clone tools, or inpainting for larger fixes.
- Adjust exposure, contrast, and color so the image matches your brand palette.
- Crop to each channel's aspect ratio.
- Add the headline, logo, and legal line as real text and vector artwork.
- Sharpen lightly for the final size and export with the right compression.
Order of operations
Work from the largest changes to the smallest, and keep an untouched original.
Crop before adding text. Headline position depends on the final frame, and a crop can cut off a headline you placed earlier. Sharpen last, after resizing, because resizing softens the image.
A scripted finishing pass
This script applies a mild color correction and sharpening, then adds a headline. It needs Pillow 10.1 or later, because ImageFont.load_default(size=...) takes a size only from that version. For brand work, load your own font file with ImageFont.truetype.
from pathlib import Path
from PIL import Image, ImageDraw, ImageEnhance, ImageFilter, ImageFont, ImageOps
def finish(source_path, out_path, size, headline):
with Image.open(source_path) as img:
img = img.convert("RGB")
img = ImageOps.autocontrast(img, cutoff=1)
img = ImageEnhance.Color(img).enhance(1.05)
img = ImageOps.fit(img, size, method=Image.Resampling.LANCZOS)
draw = ImageDraw.Draw(img)
font = ImageFont.load_default(size=size[0] // 14)
draw.text((size[0] // 20, size[1] // 20), headline, font=font, fill="white")
img = img.filter(ImageFilter.UnsharpMask(radius=1.2, percent=60, threshold=3))
Path(out_path).parent.mkdir(parents=True, exist_ok=True)
img.save(out_path, quality=90)
finish("bottle_hero.png", "final/bottle_link_ad.jpg", (1200, 628), "Fill up. Head out.")The headline sits in the top-left corner, where the brief asked for empty space. If the generated image has no clear area there, fix that in the prompt rather than covering the subject.
Common mistakes
| Mistake | Effect | Fix |
|---|---|---|
| Heavy saturation boost | Skin and product colors look fake, brand colors drift | Keep adjustments small and compare against the brand hex values |
| Over-sharpening | Halos around edges, visible on small screens | Use a low percent and check at 100% zoom |
| Text placed before cropping | Headline gets clipped on some channels | Crop first, then place text |
| Repeated JPEG saves | Compression artifacts build up | Edit in PNG, export JPEG once |
| Upscaling a small generation | Soft, smeared detail | Generate larger or use a dedicated upscaler, then check it |
Finish with a review at the final size, on a phone if the channel is mobile. Defects that are hidden in the editor often show up there.
Exercise
You placed a headline on a 1080x1350 version of an image, and now need the 1080x1920 story version. Why should you re-crop from the clean image and place the text again, rather than resizing the finished portrait file?
Show answer
Resizing or stretching the finished file would distort the text and cut or squash the subject. Cropping the clean image to the story ratio first, and then placing the headline in the new frame, keeps the subject framed correctly and the text undistorted and inside the safe area.