The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Not in one OpenAI Images API request. The n parameter controls how many images are generated, while size is one value for the whole request. You can generate several images at the same dimensions in one call; to get square, landscape and portrait versions, make a request for each size or generate one image and resize or crop it in your own code.
What one request can—and cannot—do
An Images API request accepts a single size value. Setting n to a number greater than one asks for that many images at the selected size; it does not assign a different size to each result. For example, n=3 and size="1024x1024" requests three square images, not one square, one landscape and one portrait image.
The OpenAI Image generation guide describes n as a way to generate multiple images in one request. The Images API reference defines n as the number of images and size as the size of the generated images, with a singular size value. The official Python SDK likewise exposes a singular size argument. There is no documented list-of-sizes form such as size=["1024x1024", "1536x1024"].
Choose between separate generation requests and local image processing based on whether each layout needs its own composition. Separate requests let the model compose for each aspect ratio. A master image resized or cropped locally can keep the source artwork consistent and avoid additional generation requests, but a crop may cut off important content or leave a layout poorly composed.
#1 Best Overall
- 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
- Optical Zoom: 4x optical zoom with a 27mm wide angle lens for flexible framing indoors or outdoors
- Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
- Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
- LCD Screen and Battery: 2.7in LCD screen with 2 AA alkaline batteries for convenient on-the-go use
Generate multiple images at one size
Use n when you want several alternatives with the same dimensions. This Python example saves each returned GPT image to its own PNG file:
import base64
from openai import OpenAI
client = OpenAI()
result = client.images.generate(
model="gpt-image-2",
prompt="A clean product illustration of a reusable water bottle on a studio background",
size="1024x1024",
n=3,
)
for index, item in enumerate(result.data):
image_bytes = base64.b64decode(item.b64_json)
with open(f"bottle-{index}.png", "wb") as output:
output.write(image_bytes)
This requests three images, each at 1024x1024. GPT image models return image data in base64 form, so decode each item before writing the bytes as an image file. The example assumes the OpenAI Python SDK is installed and your API credentials are configured for the client; it does not set credentials in source code.
Use n=1 when you want one result from a particular size request. Increasing n increases the number of results at that same size; it does not change the request into a multi-dimension batch.
Generate one image for each required dimension
For distinct aspect ratios, make a request for every target dimension. A simple loop reduces duplicated code while keeping each output’s composition tied to its intended shape:
Rank #2
- 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
- Optical Zoom: 5x optical zoom with a 28mm wide angle lens for flexible framing indoors or outdoors
- Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
- Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
- LCD Screen and Battery: 2.7in LCD screen and a rechargeable lithium-ion battery for on-the-go use
from openai import OpenAI
client = OpenAI()
prompt = "A clean product illustration of a reusable water bottle on a studio background"
sizes = ["1024x1024", "1536x1024", "1024x1536"]
for size in sizes:
result = client.images.generate(
model="gpt-image-2",
prompt=prompt,
size=size,
n=1,
)
item = result.data[0]
save_image(item, size)
Replace save_image with your application’s image decoder and file-writing function; its implementation depends on your storage and naming conventions. For example, decode item.b64_json as in the previous example and include the size in the output filename. This loop makes three generation requests, each with its own size. If a request fails, handle that result at the individual-size level so one failed output does not silently become a purported complete set.
Using the same prompt in each request is a useful baseline, but the model may not produce pixel-identical subjects, object placement or details across independent generations. If the assets need a consistent central subject and matching visual details, consider generating a larger or broader master composition and cropping it to each delivery shape. Inspect the crops before publishing: content near the edges is the most likely to be lost.
Choose between native aspect ratios and post-processing
| Approach | Best when | Trade-off |
|---|---|---|
| One generation request per size | Each asset needs a composition designed for its final aspect ratio. | Requires a separate API request for each target size; independently generated images can vary in details. |
| One master generation, then local resizing or cropping | Keeping a common source image matters more than model-native composition in every format. | Resizing changes dimensions but not composition; cropping can remove important content or create awkward framing. |
One request with n greater than one |
You want several image alternatives at one selected size. | It does not produce different dimensions within that request. |
The first two rows involve a practical design choice, not an API switch that automatically produces the benefits of both. If the square, landscape and portrait layouts each need different framing, generate separately and review the results. If one composition should carry through every asset and the crop is safe, local processing may be simpler.
Which sizes can you request?
The Image generation guide lists 1024x1024 for square, 1536x1024 for landscape and 1024x1536 for portrait as recommended sizes. For applicable GPT image models, the documentation also describes custom WIDTHxHEIGHT values subject to constraints: dimensions must be multiples of 16, the aspect ratio must fall between 1:3 and 3:1, edge limits must be met, and the total pixel count must remain within the model’s limits.
Rank #3
- Latest Digital Camera Built-in Fill Light : This compact digital camera is paired with a powerful CMOS processor and image stabilization to help you take & record the most exciting moments in 44 MP quality images & FHD 1080P quality videos anywhere, anytime. Plus, there is also a built-in fill light to help you take high quality pictures even in low light&dark settings, making this the perfect camera for all indoors/outdoors situations.
- Long-Lasting Battery Life & 16X Digital Zoom :This point and shoot camera will retain its battery charge even after long use. The controls and functions are easy to operate making this the perfect choice for children, teens and younger. This kids camera supports 16x digital zoom, you can zoom in or out the subject by pressing the W/T button for taking still photos to zoom in or out on distant objects and capture all the details you need.
- Multifunctional & Portable Digital Camera: This cheap digital camera is slim enough to fit in your pocket. You'll easily be able to take it with you on all your indoor/outdoor activities and adventures and ideal for beginners, children and teenagers. This kids digital camera is equipped with 20 filters, anti-shaking, self-timer, continuous shooting, date stamp, time-lapse recording, smile capture, internal MIC and speaker (recording sound videos), great for your daily photography needs.
- WEBCAM & PAUSE FUNCTION : More than just a FHD 1080p digital camera, it also works as a webcam for video calls and vlogging. Connect the camera to the computer, press shutter and power button at the same time and the camera will automatically turn on webcam mode for all your video calling and live streaming needs. The pause function allows you to pause when seeing playback videos.
- A Must Have Photography Device : This digital camera with SD card made from high-quality materials, this retro camera is safe and durable. Perfect for all ages to develop & improve their photographic abilities and observation skills. Our dedicated and experienced 24/7 support team is available for all after purchase troubleshooting, questions and technical help.
Those custom-dimension rules are model-dependent. Do not assume that a size supported by one image model is accepted by every model. Check the Images API reference for the model you are using before building a production size list; the reference also documents legacy DALL·E size choices. The recommended sizes above are the clear starting point when you need standard square, landscape and portrait outputs.
Response handling depends on the model
The code above targets gpt-image-2 and reads b64_json from each result. GPT image models return base64 image data. Legacy DALL·E models have documented URL or base64 response-format options, so do not assume that all model responses can be saved using the exact same handling code. Check the API reference for the response format supported by the model and request you choose.
In a multi-size workflow, keep a record of the requested size alongside each saved image. That makes it easier to detect missing outputs and prevents a file from being labeled with a dimension that was never requested. If your application creates a final asset set from multiple calls, treat completion as a per-size condition: a set is complete only when every required request has returned an image your application successfully saved.
Performance, reliability and cost considerations
- Request count: With one call per distinct size, the number of generation requests equals the number of sizes. A single call using
ncan return multiple images, but only at one selected size. - Latency: Separate calls require separate generation work. The documentation cited here does not give a universal latency figure, so plan around measured behavior for your model and application rather than assuming a fixed duration.
- Cost: The cited parameter documentation does not establish a single cost for every model, size and output count. Check current model pricing for your intended configuration. Generating a master and processing it locally avoids additional generation calls for each derivative, but may not satisfy a need for natively composed layouts.
- Retries: Record which requested dimensions succeeded. Retry only missing or failed sizes in your orchestration rather than regenerating the entire set unnecessarily.
- Visual review: A successful response only establishes that an image was returned, not that every crop or format is compositionally suitable. Review each required ratio in its final layout.
Troubleshooting common implementation mistakes
Every returned image has the same dimensions
That is expected when the images came from one request. n changes the number of outputs; it does not vary size. Send another generation request with the next required size.
Rank #4
- 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
- Optical Zoom: 5x optical zoom with a 28mm wide angle lens for flexible framing indoors or outdoors
- Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
- Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
- LCD Screen and Battery: 2.7in LCD screen and a rechargeable lithium-ion battery for on-the-go use
The request rejects a custom dimension
Check the model’s documented size constraints, including the multiples-of-16 requirement, aspect-ratio range and model edge and total-pixel limits. If you do not need a custom shape, use one of the recommended dimensions listed above.
The saved image is invalid or empty
For a GPT image model, confirm that your code reads the returned base64 image data, decodes it, and writes the decoded bytes rather than the base64 text. Also check that your application is reading the correct result item for each generated image.
The code expects a URL but receives base64 data
Response formats depend on the model. GPT image models return base64 image data; legacy DALL·E models document URL or base64 options. Use response handling that matches the chosen model rather than applying URL-based download logic to base64 data.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesThe assets do not match closely across sizes
Separate generation requests can compose the subject differently, even when you reuse a prompt. If close visual continuity matters more than composition tailored to each shape, generate a master image and test local resizing or cropping. If the crop loses important details, return to separate generations and adjust the prompt or framing for the affected ratio.
Or skip the browser setup
ScreenshotNeo is a separate product for capturing website screenshots; it does not generate or resize images with OpenAI’s Images API. If your task is to capture a web page rather than generate artwork, one GET request returns a screenshot. The API accepts cookie banners and removes known consent platforms, newsletter popups and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server offers screenshot tools to AI agents. See the ScreenshotNeo API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo includes 1,000 screenshots a month on its free plan with no card; paid plans start at $5 for 3,000. Learn about ScreenshotNeo or sign up for 1,000 free screenshots a month with no card.
Quick Recap
References
- OpenAI, Image generation guide: documented use of
nand recommended sizes. - OpenAI, Images API reference: request parameters, model-specific size limits and response formats.
- OpenAI, openai-python source: the
images.generatemethod’snand singularsizearguments.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.

