제품 디자인 유지
제품의 형태, 비율, 색상, 로고, 패키지 문구가 원본에서 의도치 않게 바뀌지 않는지 확인합니다.
모델 가이드
gemini-3.1-flash-image
일상 생성과 편집에 적합하며 여러 출력 크기와 비율을 제공하는 균형 경로입니다.
현재 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.
현재 이미지 스튜디오에서 사용할 수 있는 설정입니다.
이미지 스튜디오와 같은 요청 형식을 사용한 예시입니다.
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})")
이 이미지에는 생성에 사용한 모델과 프롬프트가 기록되어 있지 않습니다. 시각 예시이며 모델 테스트 결과가 아닙니다.



테스트 기록
같은 절차로 다시 확인할 수 있는 공개 테스트 결과만 표시합니다. 공개되지 않은 내용은 표시하지 않습니다.
제품의 형태, 비율, 색상, 로고, 패키지 문구가 원본에서 의도치 않게 바뀌지 않는지 확인합니다.
피사체와 가장자리가 유지되는지, 요청한 배경으로 바뀌었는지, 불필요한 변화가 없는지 확인합니다.