
1.노드 구성
1) GPT 이미지 생성모델에게 프롬프트를 전달하여 이미지 생성요청
2) 생성한 바이너리 이미지를 읽어서 png로 저장
3) 로컬 PC에 저장
2.GPT 이미지 모델 연결
1) gemini
: (aisudio) https://aistudio.google.com/prompts/new_chat
: (레퍼런스) https://ai.google.dev/gemini-api/docs/imagen?hl=ko
curl -X POST \
"https://generativelanguage.googleapis.com/v1beta/models/imagen-4.0-generate-001:predict" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"instances": [
{
"prompt": "Robot holding a red skateboard"
}
],
"parameters": {
"sampleCount": 4
}
}'
* API-Key를 생성해서 간단하게 테스트 가능: 생성량 제한이 있을껀데, 무한정 무료는 아닐꺼라서... chatgpt에게 물어보면 어느정도 무료로 쓸수 있다고 나오긴함,
-------------------------------------- chatgpt 답변 -----------------------------
1. Gemini 앱 (웹/모바일): 무제한 무료 사용
- Gemini 앱 내에서는 Imagen 4 기반 이미지 생성이 무료로 제공됩니다. 기본 모델 품질 이용 시 요금이 부과되지 않으며, 단, 일일 생성량은 시스템 부하에 따라 제한될 수 있습니다.
DEV Community+15Zenn+15DEV Community+15 - 무료 계층에서 주로 쓰는 모델은 Imagen 4이며, **고급 기능(예: 심화 편집, 고속 처리)**은 유료 계층으로 제한됩니다.

2) google cloud vertax ai (결국 gemini 모델을 쓰긴함)
- 무료 크레딧이 있으므로, 그 크레딧을 사용하는 기간에는 안정적으로 이미지 생성 가능
- vertax ai api를 사용하기 클릭해서 권한받고 진행

- 레퍼런스 사이트를 찾는 과정이 너무 삽질이 길었다. 구글 could 쪽은 이게 문제인듯....
- (레펀런스) https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api?hl=ko#rest
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://${LOCATION}-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}/publishers/google/models/${MODEL_VERSION}:predict \
-d '{
"instances": [
{
"prompt": "..."
}
],
"parameters": {
"sampleCount": ...
}
}'

* 인증은 두가지 방식을 지원하는거 같은데(API-KEY, auth2), api-key로는 오류가 나서, 기존 AUTH2 방식(google cloud nature langage)으로 설정한걸 사용했다.
3) fal.ai (recraft)
- 유로 버전은 fal.ai 인터페이스가 가장 쉬운듯(모델도 많음)
https://fal.ai/models/fal-ai/recraft/v3/text-to-image
Recraft V3 | Text to Image | fal.ai
Recraft V3 is a text-to-image model with the ability to generate long texts, vector art, images in brand style, and much more. As of today, it is SOTA in image generation, proven by Hugging Face's industry-leading Text-to-Image Benchmark by Artificial Anal
fal.ai
3.생성해온 이미지를 png로 변환 (code node)
// predictions[0].bytesBase64Encoded 값 꺼내기
const b64 = $json.predictions[0].bytesBase64Encoded;
// Binary 데이터로 변환해서 반환
return [{
json: {}, // JSON 결과는 비워두고
binary: {
data: {
data: b64, // Base64 문자열
fileName: 'output.png', // 저장할 파일명
mimeType: $json.predictions[0].mimeType || 'image/png'
}
}
}];
3.최종결과
- gemini 버전

- vertax 버전(이것도 gemini 모델임)

'AI > n8n' 카테고리의 다른 글
| [n8n-step5] youtobe에 업로드하기 (3) | 2025.08.30 |
|---|---|
| [n8n-step4] audio-text 합성(Docker + FFMpeg) (1) | 2025.08.29 |
| [n9n-step2.1] text파일 읽어와서 음성변환 (2) | 2025.08.25 |
| [n8n-step2] text를 음성으로 변환해보자 (6) | 2025.08.23 |
| [n8n-step1] Window(로컬PC)에서 docker로 n8n 설치 실행하기 (3) | 2025.08.21 |




























