FirebaseAILogic Framework Reference

AspectRatio

struct AspectRatio : Sendable, Equatable

An aspect ratio for generated images.

  • Square (1:1) aspect ratio.

    Common uses for this aspect ratio include social media posts.

    Declaration

    Swift

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

    This is the landscape16x9 aspect ratio rotated 90 degrees. This is 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: ImageConfig.AspectRatio
  • 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: ImageConfig.AspectRatio
  • Portrait full screen (3:4) aspect ratio.

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

    Declaration

    Swift

    public static let portrait3x4: ImageConfig.AspectRatio
  • 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: ImageConfig.AspectRatio
  • Portrait (2:3) aspect ratio.

    Declaration

    Swift

    public static let portrait2x3: ImageConfig.AspectRatio
  • Landscape (3:2) aspect ratio.

    Declaration

    Swift

    public static let landscape3x2: ImageConfig.AspectRatio
  • Portrait (4:5) aspect ratio.

    Declaration

    Swift

    public static let portrait4x5: ImageConfig.AspectRatio
  • Landscape (5:4) aspect ratio.

    Declaration

    Swift

    public static let landscape5x4: ImageConfig.AspectRatio
  • Portrait (1:4) aspect ratio.

    Declaration

    Swift

    public static let portrait1x4: ImageConfig.AspectRatio
  • Landscape (4:1) aspect ratio.

    Declaration

    Swift

    public static let landscape4x1: ImageConfig.AspectRatio
  • Portrait (1:8) aspect ratio.

    Declaration

    Swift

    public static let portrait1x8: ImageConfig.AspectRatio
  • Landscape (8:1) aspect ratio.

    Declaration

    Swift

    public static let landscape8x1: ImageConfig.AspectRatio
  • Ultrawide (21:9) aspect ratio.

    Declaration

    Swift

    public static let ultrawide21x9: ImageConfig.AspectRatio