◉GEMINI LABJP
●CHANGELOG — No new Gemini API changelog entries since 11/19; the stable CLI is still v0.70.0●2.5 ROUTE — From 12/1, gemini-2.5-pro reroutes to 3.8 Flash and 2.5-flash to 3.5 Flash-Lite. 8 days left●SPEND CAP — Developers are asking for a hard spend limit on the API. Set budget alerts and decide how you would pause a key●CARBON — Gemini 4 Carbon launch pricing ends 11/30, 7 days left●OMNI 1.2 — On 12/3, gemini-omni-1.1-flash switches to 1.2 automatically●/SHELLS — /shells still appears in the docs but was removed. If a command fails, check whether it still exists●CHANGELOG — No new Gemini API changelog entries since 11/19; the stable CLI is still v0.70.0●2.5 ROUTE — From 12/1, gemini-2.5-pro reroutes to 3.8 Flash and 2.5-flash to 3.5 Flash-Lite. 8 days left●SPEND CAP — Developers are asking for a hard spend limit on the API. Set budget alerts and decide how you would pause a key●CARBON — Gemini 4 Carbon launch pricing ends 11/30, 7 days left●OMNI 1.2 — On 12/3, gemini-omni-1.1-flash switches to 1.2 automatically●/SHELLS — /shells still appears in the docs but was removed. If a command fails, check whether it still exists
Articles/Advanced
⬡ Advanced/2026-06-13Advanced

Gemini's GA Image Models Won't Output Exact Device Resolutions — A Wallpaper Pipeline That Fixes Aspect Ratio and Safe Areas

After switching to the GA image models, your wallpapers no longer fit the screen. Here's how to crop one master image into every device resolution and cut your generation count to a fraction, with full Pillow code.

gemini121image-generation9wallpaperpillowproduction140

✦ Premium Article

Right after moving to the GA image models, I noticed the wallpapers I generated no longer fit the iPhone screen cleanly. I was sending the exact same prompts I had tuned during the preview era, yet some came back with bands of empty space top and bottom, and others had the subject clipped at the edges. The reason is simple: image models don't honor a pixel request like "give me 1206×2622 pixels." They return one of a fixed set of aspect ratios.

If you run a wallpaper app as an indie developer for any length of time, this mismatch between "what the model returns" and "what the device demands" is unavoidable. And since gemini-3.1-flash-image-preview and gemini-3-pro-image-preview are scheduled to shut down on 6/25, migrating to the GA models is exactly when this problem hits you head-on. Below is the "crop every device size from a single master" design I use in my own wallpaper generation pipeline, with working code.

Why pixel requests don't work

When you ask an image model for "1206×2622px output" — whether in the prompt or a parameter — what comes back is rounded to one of the aspect ratios the model supports (1:1, 3:4, 4:3, 9:16, 16:9, and so on). This is true on both the GA and the preview models. The model understands ratios, but it will not produce absolute pixel dimensions tailored to your device.

A wallpaper app, on the other hand, needs exact device pixels. Line up the major portrait devices and the required resolutions cluster like this:

  • iPhone Air: 1260 × 2736 px (aspect ratio ~0.46)
  • iPhone 17 Pro: 1206 × 2622 px (~0.46)
  • iPhone 16/17 Pro Max: 1320 × 2868 px (~0.46)
  • Pixel 9 Pro class Android: 1280 × 2856 px (~0.448)
  • Common Android xxxhdpi portrait wallpaper: 1440 × 3200 px (~0.45)

Notice that every ratio sits between 0.45 and 0.46. That is taller than 9:16 (= 0.5625). In other words, an image generated at 9:16 is "wider" than what the device wants, so trimming the horizontal edges covers every model. That points to the most robust approach: generate at 9:16, then resolve the exact pixels in post-processing.

The starting decision — crop every device from one master

This is the most important judgment in this article. Rather than calling the generation API once per device, I recommend generating a single, sufficiently large master image and cropping/resizing it down to each device resolution.

There are two reasons. The first is cost. Image generation is billed per image. Say it's $0.04 per image: generating four device variants separately means four charges per design. Cropping from one master means a single charge, cutting the generation count to a fraction of the device count — in this case 1/4. If you're preparing 1,000 wallpaper designs, that's 4,000 calls dropping to 1,000.

The second is consistency. Generate per device and the same prompt drifts slightly in composition and color each time. Derive everything from one master and every device gets exactly the same artwork.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦If your GA image-model output never matched device resolutions, you'll walk away with code that crops one master into every device size precisely
✦You'll be able to switch a per-device pipeline that ran up API costs into one that cuts generations to a fraction of the device count
✦With safe-area-aware prompts and cropping, you can ship wallpapers at scale without the subject getting clipped
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⬡ Advanced2026-04-27
Self-Healing Architecture for Gemini Computer Use — Production Patterns That Keep Browser Automation Alive Beyond Day Three
Gemini Computer Use looks magical in demos but breaks daily in production: vanishing elements, surprise modals, network jitter, off-by-four-pixel clicks. This guide builds a five-layer self-healing architecture in Python that classifies failures and recovers them automatically, with working code you can drop into your agent loop today.
⬡ Advanced2026-04-25
Building Self-Critiquing Agents with Gemini API: A Production-Ready Guide to Reflection and Critic-Refiner Patterns
A production-grade walkthrough of Reflection and Critic-Refiner patterns with Gemini 3 Pro and 3.5 Flash-Lite. Covers implementation, cost guards, over-correction defenses, and monitoring signals from real deployments.
⬡ Advanced2026-04-24
Safely Migrating Gemini Model Versions with Shadow Traffic — A Production Pattern for Measuring Output Drift
Stop treating Gemini model migrations as a coin flip. This guide walks through a production-ready shadow traffic architecture — duplicate real inputs to the new model, quantify output drift, and cut over progressively. Includes Python and Cloud Tasks code you can ship today.