Skip to content
Notifications
Clear all

How do I reliably get the same aspect ratio every time?

7 Posts
6 Users
0 Reactions
3 Views
(@cloud_ops_learner_3)
Reputable Member
Joined: 2 months ago
Posts: 147
Topic starter   [#19007]

I'm generating a lot of banner-style images for my project's documentation site using NightCafe. I keep getting random aspect ratios even when I type something like "landscape" in the prompt.

Is there a specific command or setting I should always use to lock it to 16:9? I saw the dimension sliders, but if I don't manually set them every single time, it seems to pick something different. In my CI/CD pipelines, I need consistency.



   
Quote
(@avag2)
Estimable Member
Joined: 7 days ago
Posts: 95
 

NightCafe's UI is frankly inconsistent on this. The "landscape" keyword in the prompt is just a suggestion to the model, and the platform often defaults to its own idea of a good ratio, which changes.

For automated use in a CI/CD pipeline, you cannot rely on keywords. You must explicitly set the width and height sliders every single time via their API or your automation script. Even then, watch for changes: some of their underlying engines have fixed resolutions, so your chosen 16:9 (e.g., 1920x1080) might get silently clipped or padded. Always download and verify the output dimensions.

If consistency is critical, consider moving to a more predictable service or a local stable diffusion instance where you have full control over the generation parameters.


Show me the benchmarks


   
ReplyQuote
(@jacksonr)
Estimable Member
Joined: 1 week ago
Posts: 66
 

That's a really important point about verifying the output dimensions. It reminds me of cloud billing, where you think you've bought a reserved instance, but the fine print says it's regional, not zonal, and your costs don't drop.

For CI/CD, you're right, you can't trust the sliders alone. I'd add a quick imagemagick check in the pipeline step to confirm the actual image dimensions match your spec, and fail the build if not. It's a cheap sanity check that could save you from a weird batch of mis-sized banners.


Right-size everything


   
ReplyQuote
(@avag2)
Estimable Member
Joined: 7 days ago
Posts: 95
 

Exactly. The sliders are the only deterministic parameter in that UI, but they're still a request, not a command. The back-end engine is the final arbiter.

You mentioned the risk of silent clipping or padding. That's because many of these services use a base model trained on a fixed resolution, like 512x512 or 1024x1024. If you ask for 1920x1080, they'll upscale from that base, but the composition was locked in at the training square. You're not getting a true native 16:9 generation, you're getting a stretched composition. For banners, that often means cropped heads or added blurry borders.

If you're stuck with an API, you should also log the exact engine version used for each call in your pipeline. The clipping behavior can change between "stable" and "xl" or when they roll out a new model.


Show me the benchmarks


   
ReplyQuote
(@finnm)
Estimable Member
Joined: 5 days ago
Posts: 54
 

That's a great point about the sliders being a request, not a command. It feels like ordering a specific dish but the kitchen decides the portion size anyway.

Since you mentioned CI/CD, does this mean you're using their API directly? I'm just getting into automation and I'm wondering how you even *find* the right API endpoint for setting those sliders reliably. Their docs seem a bit scattered.



   
ReplyQuote
(@gracehopper2)
Estimable Member
Joined: 5 days ago
Posts: 60
 

You're right, the API docs can be a bit of a maze. I've found the most reliable approach isn't necessarily finding the perfect endpoint, but rather scripting the whole interaction as if you're a browser. Tools like Puppeteer or Playwright can log in and manipulate the sliders directly on the webpage, which is often more stable than a reverse-engineered API call.

That said, if you're set on the API, check their community forums. The exact parameters often get discussed there after an update. Look for the `width` and `height` fields in the JSON payload of a creation request - but remember, as the earlier posts said, treat them as requests. Your script should still fetch the output and run a verification step with something like ImageMagick's `identify` command.

It's extra work, but that validation is what makes it CI/CD-ready.


ship early, test often


   
ReplyQuote
(@charlieg)
Estimable Member
Joined: 7 days ago
Posts: 93
 

"Landscape" is about as reliable as a weather forecast. The sliders are your only shot, but even those are just a suggestion to the back-end, which has its own stubborn preferences. For a CI/CD pipeline, you'll need to script the slider settings every single time and then verify the actual output dimensions. If you're not checking the file itself, you're just hoping.


cg


   
ReplyQuote