FirebaseVertexAI Framework Reference

ImagenAspectRatio

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public struct ImagenAspectRatio : Sendable

An aspect ratio for images generated by Imagen.

To specify an aspect ratio for generated images, set aspectRatio in your ImagenGenerationConfig. See the Cloud documentation for more details and examples of the supported aspect ratios.

  • Square (1:1) aspect ratio.

    Common uses for this aspect ratio include social media posts.

    Declaration

    Swift

    public static let square1x1: ImagenAspectRatio
  • Portrait widescreen (9:16) aspect ratio.

    This is the landscape16x9 aspect ratio rotated 90 degrees. This a relatively new aspect ratio that has been popularized by short form video apps (for example, YouTube shorts). Use this for tall objects with strong vertical orientations such as buildings, trees, waterfalls, or other similar objects.

    Declaration

    Swift

    public static let portrait9x16: ImagenAspectRatio
  • Widescreen (16:9) aspect ratio.

    This ratio has replaced landscape4x3 as the most common aspect ratio for TVs, monitors, and mobile phone screens (landscape). Use this aspect ratio when you want to capture more of the background (for example, scenic landscapes).

    Declaration

    Swift

    public static let landscape16x9: ImagenAspectRatio
  • Portrait full screen (3:4) aspect ratio.

    This is the landscape4x3 aspect ratio rotated 90 degrees. This lets to capture more of the scene vertically compared to the square1x1 aspect ratio.

    Declaration

    Swift

    public static let portrait3x4: ImagenAspectRatio
  • Fullscreen (4:3) aspect ratio.

    This aspect ratio is commonly used in media or film. It is also the dimensions of most old (non-widescreen) TVs and medium format cameras. It captures more of the scene horizontally (compared to square1x1), making it a preferred aspect ratio for photography.

    Declaration

    Swift

    public static let landscape4x3: ImagenAspectRatio