Skip to content

Conversation

@pbakaus
Copy link

@pbakaus pbakaus commented Dec 19, 2025

This PR adds support for specifying aspect ratios when generating images and stories. Users can now use the --aspect-ratio flag with values like 16:9, 4:3, 1:1, etc.

Implementation Details

  • any Casting in imageGenerator.ts:
    The Google GenAI Node.js SDK's current type definitions for generateContent configuration (GenerationConfig) do not yet include the imageConfig property used by the image generation models. To bypass this type check while ensuring the parameter is correctly passed to the API (which supports it), I've cast the config object to any. Not ideal, but allows us to leverage the feature immediately without waiting for SDK type updates.

  • Validation:
    Added a validation step to ensure only supported aspect ratios are passed to the API.

Usage

You can now control the dimensions of your generated images using the --aspect-ratio flag.

Generate Command

# Cinematic widescreen
/generate "A cyberpunk city" --aspect-ratio="21:9"

# Portrait for mobile
/generate "A fashion model" --aspect-ratio="9:16"

Story Command

The aspect ratio applies to all frames in the story sequence.

/story "A space opera" --steps=4 --aspect-ratio="16:9"

Supported Ratios

  • 1:1 (Square)
  • 3:4, 4:3
  • 9:16, 16:9
  • 21:9 (Ultrawide)
  • 3:2, 2:3
  • 5:4, 4:5

Adds support for aspect ratio configuration in image generation and story commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant