Understanding Aspect Ratios in Our APIs

Created by Joshua Lopez, Modified on Wed, 16 Oct at 12:51 PM by Joshua Lopez

Introduction

Aspect ratios are a crucial parameter in image generation, determining the width-to-height relationship of your images. When using our API, selecting the appropriate aspect ratio ensures that your images meet your specific requirements. This article outlines the valid aspect ratios available through our API and their corresponding image dimensions.


What is an Aspect Ratio?

An aspect ratio expresses the proportional relationship between an image's width and height. It is represented as two numbers separated by a colon (e.g., 16:9). Understanding and selecting the correct aspect ratio can help maintain the visual integrity of your images, especially when used in specific contexts like social media, websites, or presentations.


Valid Aspect Ratios and Image Dimensions

Here is a list of valid aspect ratios you can use in your API requests, along with their corresponding image dimensions:


Aspect RatioImage Dimensions (Width x Height)
16:91344 x 768
1:11024 x 1024
21:91536 x 640
2:3832 x 1216
3:21216 x 832
4:5896 x 1088
5:41088 x 896
9:16768 x 1344
9:21640 x 1536


How to Use Aspect Ratios in Your API Request

When making an API call, you can specify the desired aspect ratio as a parameter. For example:

   data={
        "prompt": "Lighthouse on a cliff overlooking the ocean",
        "aspect_ratio": "9:21",
        "output_format": "webp",
    },

Please note that only the following API endpoints currently have support for the "aspect_ratio" parameter to be set: 


Conclusion

Selecting the appropriate aspect ratio is essential for generating images that fit your needs. By understanding how aspect ratios translate to specific image dimensions, you can make informed decisions when using our API. If you have further questions or need assistance, feel free to contact our support team here



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article