Skip to content

Commit d7d2bd4

Browse files
authored
Adding aspect ratio example (#979)
* Adding aspect ratio example * Minimum version
1 parent ee02ed4 commit d7d2bd4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

quickstarts-js/Image_out.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
5252
*/
5353

5454
// [CODE STARTS]
55-
module = await import("https://esm.sh/@google/genai@1.4.0");
55+
module = await import("https://esm.sh/@google/genai@1.22.0");
5656
GoogleGenAI = module.GoogleGenAI;
5757
ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
5858

@@ -154,7 +154,13 @@ response = await ai.models.generateContent({
154154
mimeType: "image/png"
155155
}
156156
}
157-
]
157+
],
158+
config: {
159+
responseModalities: [Modality.IMAGE],
160+
imageConfig: {
161+
aspectRatio: "16:9"
162+
},
163+
}
158164
});
159165

160166
for (const part of response.candidates[0].content.parts) {
@@ -498,3 +504,5 @@ Gemini is not only good at generating images, but also at understanding them. Ch
498504
499505
500506
*/
507+
508+

0 commit comments

Comments
 (0)