주요 콘텐츠로 이동

모델 가이드

Nano Banana 2

gemini-3.1-flash-image

균형형

일상 생성과 편집에 적합하며 여러 출력 크기와 비율을 제공하는 균형 경로입니다.

0.5K~4K이미지 편집
모델 정보
모델 ID
gemini-3.1-flash-image
참고 가격
$0.055/회
출력 크기
512 / 1K / 2K / 4K
API 형식
Gemini native

프롬프트 프리셋

현재 YingTu에서 사용할 수 있는 설정입니다.

상품 사진

A clean product photo of a matte ceramic coffee mug on a light stone table, soft window light, natural shadows, minimal styling.

에디토리얼 풍경

An editorial travel photograph of a mountain lake at sunrise, layered atmospheric depth, natural color, fine detail.

참고 이미지 편집

Preserve the main subject and composition. Replace the background with a quiet modern studio using soft directional daylight.

사용 가능한 설정

현재 이미지 스튜디오에서 사용할 수 있는 설정입니다.

적합한 작업

  • 일상 이미지 생성
  • 참고 이미지를 이용한 편집
  • 여러 출력 크기 테스트

사용 전 확인

  • 표시된 속도는 예상치이며 완료 시간을 보장하지 않습니다.
  • 편집 품질은 참고 이미지와 지시에 따라 달라집니다.
  • 사용 전에 텍스트, 로고, 손, 작은 세부 사항을 확인하세요.
이미지 편집: 지원

API 빠른 시작

이미지 스튜디오와 같은 요청 형식을 사용한 예시입니다.

API 페이지 보기
gemini-3.1-flash-image
import base64
import mimetypes
import os
import sys

import requests

API_KEY = os.environ.get("LAOZHANG_API_KEY")
if not API_KEY:
    raise RuntimeError("Set the LAOZHANG_API_KEY environment variable before running this example.")

API_URL = "https://api2.laozhang.ai/v1beta/models/gemini-3.1-flash-image:generateContent"
REQUEST_TIMEOUT_SECONDS = 500

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json",
}

payload = {
    "contents": [{
        "parts": [
            {"text": "A clean product photo of a matte ceramic coffee mug on a light stone table, soft window light, natural shadows, minimal styling."}
        ]
    }],
    "generationConfig": {
        "responseModalities": ["IMAGE"],
        "imageConfig": {
            "imageSize": "2K"
        }
    }
}

try:
    response = requests.post(
        API_URL,
        headers=headers,
        json=payload,
        timeout=REQUEST_TIMEOUT_SECONDS,
    )
except requests.Timeout as error:
    print(
        "Request timed out after 500 seconds. The result status may be unknown; "
        "check call and billing logs before retrying.",
        file=sys.stderr,
    )
    raise SystemExit(1) from error

if response.status_code != 200:
    print(f"API error {response.status_code}: {response.text}", file=sys.stderr)
    raise SystemExit(1)

try:
    result = response.json()
except ValueError as error:
    print("API returned a non-JSON response.", file=sys.stderr)
    raise SystemExit(1) from error

if not isinstance(result, dict):
    print("API returned an unexpected JSON shape.", file=sys.stderr)
    raise SystemExit(1)

image_part = None
for candidate in result.get("candidates", []):
    for part in candidate.get("content", {}).get("parts", []):
        inline_data = part.get("inlineData") or part.get("inline_data")
        if inline_data and inline_data.get("data"):
            image_part = inline_data
            break
    if image_part:
        break

if not image_part:
    response_id = result.get("responseId", "not provided")
    print(f"No image data in response. responseId={response_id}", file=sys.stderr)
    raise SystemExit(1)

mime_type = image_part.get("mimeType") or image_part.get("mime_type") or "image/png"
encoded_image = image_part["data"]
if encoded_image.startswith("data:"):
    header, encoded_image = encoded_image.split(",", 1)
    mime_type = header[5:].split(";", 1)[0] or mime_type

extension_by_mime = {
    "image/jpeg": "jpg",
    "image/png": "png",
    "image/webp": "webp",
    "image/gif": "gif",
}
extension = extension_by_mime.get(mime_type, "bin")
output_path = f"output.{extension}"

with open(output_path, "wb") as output_file:
    output_file.write(base64.b64decode(encoded_image, validate=True))

print(f"Image saved: {output_path} ({mime_type})")

Studio 예시

이 이미지에는 생성에 사용한 모델과 프롬프트가 기록되어 있지 않습니다. 시각 예시이며 모델 테스트 결과가 아닙니다.

Studio 예시
Studio 예시
Studio 예시

테스트 기록

YingTu 공개 테스트 결과

같은 절차로 다시 확인할 수 있는 공개 테스트 결과만 표시합니다. 공개되지 않은 내용은 표시하지 않습니다.

공개된 테스트 결과 없음

제품 디자인 유지

제품의 형태, 비율, 색상, 로고, 패키지 문구가 원본에서 의도치 않게 바뀌지 않는지 확인합니다.

공개된 테스트 결과 없음

배경 교체

피사체와 가장자리가 유지되는지, 요청한 배경으로 바뀌었는지, 불필요한 변화가 없는지 확인합니다.