mcpField
F
fal-text-to-image

fal-text-to-image

github.com/josiahsiegelクリエイティブ・メディア5974 回インストール19 週間前に更新
リポジトリ

fal-text-to-image について

fal.aiのモデルでテキストプロンプトから画像を生成するためのリファレンススキルです。開発者向けに、モデルの選択やサイズ、生成パラメーター、LoRAスタイル、バッチ生成の設定を説明します。

主な機能

  1. 01FLUX、SDXL、特化モデルを比較
  2. 02プリセットまたは任意の画像サイズを設定
  3. 03モデル固有の生成パラメーターを指定
  4. 04FLUXにLoRAスタイルを適用
  5. 05複数の画像バリエーションを生成

活用シーン

  1. 01テキストプロンプトから画像を作成
  2. 02速度や品質に応じてモデルを選択
  3. 03文字入り画像やベクター風素材を制作
  4. 04異なるスタイルの画像をまとめて生成

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/josiahsiegel/claude-plugin-marketplace --skill fal-text-to-image

インストール後、Claude Code で/fal-text-to-imageを入力して読み込まれたか確認します。

詳細

クイックリファレンス

モデルエンドポイント速度品質コスト
FLUX.2 Profal-ai/flux-2-pro中速最高$$$
FLUX.1 Devfal-ai/flux/dev中速高$$
FLUX Schnellfal-ai/flux/schnell高速良好$
Fast SDXLfal-ai/fast-sdxl高速良好$
画像サイズプリセット寸法
正方形 HDsquare_hd1024x1024
横長landscape_16_91024x576
縦長portrait_16_9576x1024
カスタム{ width, height }任意
パラメーターFLUX のデフォルトSDXL のデフォルト
guidance_scale3.57.5
num_inference_steps2825
num_images11

このスキルを使う場面

テキストから画像を生成する場合に使用します:

  • テキストプロンプトから画像を生成する
  • FLUX と SDXL のモデルを選ぶ
  • 画像サイズと品質パラメーターを設定する
  • LoRA モデルを使用して独自のスタイルを実現する
  • 複数の画像を一括生成する

関連スキル:

  • 画像編集については、fal-image-to-image を参照してください
  • モデルの比較については、fal-model-guide を参照してください
  • API の統合については、fal-api-reference を参照してください

fal.ai のテキストから画像を生成するモデル

fal.ai のテキストから画像を生成するすべてのモデルの完全なリファレンスです。

FLUX モデル

FLUX.1 [dev]

エンドポイント: fal-ai/flux/dev 料金: 1 メガピクセルあたり $0.025 最適な用途: 高品質なオープンソース生成

12B パラメーターの FLUX.1 モデルは、オープンソースとして利用でき、優れた品質を提供します。

import { fal } from "@fal-ai/client";

const result = await fal.subscribe("fal-ai/flux/dev", {
  input: {
    prompt: "A serene Japanese garden with cherry blossoms, koi pond, wooden bridge, soft morning light",
    image_size: "landscape_16_9",
    num_inference_steps: 28,
    guidance_scale: 3.5,
    num_images: 1,
    seed: 42,
    enable_safety_checker: true,
    output_format: "jpeg"
  }
});

console.log(result.images[0].url);
import fal_client

result = fal_client.subscribe(
    "fal-ai/flux/dev",
    arguments={
        "prompt": "A serene Japanese garden with cherry blossoms",
        "image_size": "landscape_16_9",
        "num_inference_steps": 28,
        "guidance_scale": 3.5,
        "num_images": 1,
        "seed": 42,
        "enable_safety_checker": True,
        "output_format": "jpeg"
    }
)
print(result["images"][0]["url"])
FLUX Schnell

エンドポイント: fal-ai/flux/schnell 料金: 画像あたりのコストが低い 最適な用途: 高速な試行、プレビュー、4 ステップ生成

推論ステップを 4 回だけ必要とするよう最適化されており、高速に動作します。

const result = await fal.subscribe("fal-ai/flux/schnell", {
  input: {
    prompt: "A colorful abstract painting",
    image_size: "square_hd",
    num_inference_steps: 4,  // Optimized for 4 steps
    num_images: 1
  }
});
FLUX Pro

エンドポイント: fal-ai/flux-pro 料金: プレミアム 最適な用途: 本番環境のワークロード

const result = await fal.subscribe("fal-ai/flux-pro", {
  input: {
    prompt: "Professional product photography of a luxury watch",
    image_size: "square_hd",
    num_inference_steps: 28,
    guidance_scale: 3.5
  }
});
FLUX.2 [pro]

エンドポイント: fal-ai/flux-2-pro 料金: 1 メガピクセルあたり $0.03 最適な用途: 最高品質、自動プロンプト強化

プロンプト最適化機能を内蔵した最新の FLUX モデルです。

const result = await fal.subscribe("fal-ai/flux-2-pro", {
  input: {
    prompt: "A majestic lion in the savanna at golden hour",
    image_size: "landscape_16_9",
    num_inference_steps: 28,
    guidance_scale: 3.5,
    // FLUX 2 Pro features
    safety_tolerance: "2",  // 1-6, higher = more permissive
    raw: false  // Set true to disable prompt enhancement
  }
});

FLUX.2 Pro 固有のパラメーター:

  • safety_tolerance:1~6。コンテンツフィルタリングの感度を制御します
  • raw:ブール値。自動プロンプト強化を無効にするには true に設定します
FLUX LoRA

エンドポイント: fal-ai/flux-lora 最適な用途: カスタム学習済みのスタイルや被写体

カスタム LoRA モデルを FLUX の生成に適用します。

const result = await fal.subscribe("fal-ai/flux-lora", {
  input: {
    prompt: "A portrait in the style of <lora_trigger>",
    loras: [
      {
        path: "https://huggingface.co/user/lora-model/resolve/main/lora.safetensors",
        scale: 0.8
      }
    ],
    image_size: "portrait_4_3",
    num_inference_steps: 28,
    guidance_scale: 3.5
  }
});

LoRA パラメーター:

  • loras:LoRA 設定の配列
    • path:LoRA の重み(.safetensors)への URL
    • scale:0~1。LoRA の効果の強さ
FLUX Realism

エンドポイント: fal-ai/flux-realism 最適な用途: 写実的な画像

const result = await fal.subscribe("fal-ai/flux-realism", {
  input: {
    prompt: "A photorealistic portrait of a young woman, natural lighting, 85mm lens",
    image_size: "portrait_4_3",
    num_inference_steps: 28
  }
});
FLUX Fill(アウトペインティング)

エンドポイント: fal-ai/flux-pro/v1/fill 最適な用途: 画像の境界を越えて拡張する

const result = await fal.subscribe("fal-ai/flux-pro/v1/fill", {
  input: {
    prompt: "Continue the landscape with mountains",
    image_url: "https://example.com/partial-image.jpg",
    mask_url: "https://example.com/outpaint-mask.png"
  }
});

Stable Diffusion モデル

Fast SDXL

エンドポイント: fal-ai/fast-sdxl 最適な用途: 高速性とコスト効率

const result = await fal.subscribe("fal-ai/fast-sdxl", {
  input: {
    prompt: "A fantasy castle on a cliff, dramatic lighting",
    negative_prompt: "blurry, low quality, distorted",
    image_size: "landscape_16_9",
    num_inference_steps: 25,
    guidance_scale: 7.5,
    num_images: 1,
    seed: 42
  }
});

SDXL 固有のパラメーター:

  • negative_prompt:生成で避ける内容
  • SDXL では、より高い guidance_scale(7~12)が効果的です
Stable Diffusion 3 Medium

エンドポイント: fal-ai/stable-diffusion-v3-medium 最適な用途: SD3 アーキテクチャ、優れたテキスト描画

const result = await fal.subscribe("fal-ai/stable-diffusion-v3-medium", {
  input: {
    prompt: "A sign that says 'Hello World' in neon lights",
    negative_prompt: "blurry, distorted text",
    image_size: "square_hd",
    num_inference_steps: 28,
    guidance_scale: 7.0
  }
});
SDXL Turbo

エンドポイント: fal-ai/sdxl-turbo 最適な用途: 超高速の 1 ステップ生成

const result = await fal.subscribe("fal-ai/sdxl-turbo", {
  input: {
    prompt: "A cute robot",
    num_inference_steps: 1,  // Single step!
    guidance_scale: 0  // No guidance needed
  }
});
SDXL Lightning

エンドポイント: fal-ai/fast-lightning-sdxl 最適な用途: 高速な 4 ステップ SDXL

const result = await fal.subscribe("fal-ai/fast-lightning-sdxl", {
  input: {
    prompt: "A beautiful sunset",
    num_inference_steps: 4,
    guidance_scale: 1.5
  }
});

特化型モデル

Recraft V3

エンドポイント: fal-ai/recraft-v3 最適な用途: デザイン素材、イラスト、ベクタースタイル

const result = await fal.subscribe("fal-ai/recraft-v3", {
  input: {
    prompt: "A minimalist logo for a tech startup, clean lines",
    image_size: "square_hd",
    style: "digital_illustration"  // or "realistic_image", "vector_illustration"
  }
});

Recraft のスタイル:

  • realistic_image
  • digital_illustration
  • vector_illustration
  • icon
Ideogram

エンドポイント: fal-ai/ideogram 最適な用途: 画像内のテキスト、タイポグラフィ

const result = await fal.subscribe("fal-ai/ideogram", {
  input: {
    prompt: "A vintage poster with the text 'JAZZ FESTIVAL' in art deco style",
    aspect_ratio: "portrait_4_3"
  }
});
Playground v2.5

エンドポイント: fal-ai/playground-v25 最適な用途: クリエイティブで芸術的な画像

const result = await fal.subscribe("fal-ai/playground-v25", {
  input: {
    prompt: "A surreal dreamscape with floating islands",
    image_size: "landscape_16_9",
    guidance_scale: 3.0
  }
});
AuraFlow

エンドポイント: fal-ai/aura-flow 最適な用途: オープンソースのフローベースモデル

const result = await fal.subscribe("fal-ai/aura-flow", {
  input: {
    prompt: "A magical forest with bioluminescent plants",
    num_inference_steps: 28,
    guidance_scale: 3.5
  }
});
Kolors

エンドポイント: fal-ai/kolors 最適な用途: 芸術的でカラフルな生成

const result = await fal.subscribe("fal-ai/kolors", {
  input: {
    prompt: "A vibrant street market in Morocco",
    image_size: "landscape_4_3"
  }
});

共通パラメーターのリファレンス

画像サイズのオプション
プリセット寸法アスペクト比
square512x5121:1
square_hd1024x10241:1
portrait_4_3768x10243:4
portrait_16_9576x10249:16
landscape_4_31024x7684:3
landscape_16_91024x57616:9

カスタム寸法:

image_size: { width: 1920, height: 1080 }
パラメーターの完全なリファレンス
interface TextToImageInput {
  // Required
  prompt: string;

  // Image dimensions
  image_size?:
    | "square" | "square_hd"
    | "portrait_4_3" | "portrait_16_9"
    | "landscape_4_3" | "landscape_16_9"
    | { width: number; height: number };

  // Generation parameters
  num_inference_steps?: number;  // 1-50, default varies by model
  guidance_scale?: number;       // 1-20, default: 3.5 (FLUX) or 7.5 (SDXL)
  num_images?: number;           // 1-4, default: 1
  seed?: number;                 // For reproducibility

  // Output options
  output_format?: "jpeg" | "png";
  enable_safety_checker?: boolean;

  // SDXL-specific
  negative_prompt?: string;

  // FLUX 2 Pro specific
  safety_tolerance?: string;     // "1" to "6"
  raw?: boolean;                 // Disable prompt enhancement

  // LoRA specific
  loras?: Array<{
    path: string;
    scale: number;
  }>;
}
レスポンス構造
interface TextToImageOutput {
  images: Array<{
    url: string;
    width: number;
    height: number;
    content_type: string;
  }>;
  seed: number;
  prompt: string;
  has_nsfw_concepts?: boolean[];
  timings?: {
    inference: number;
  };
}

モデル選択ガイド

ユースケース推奨モデル理由
最高品質fal-ai/flux-2-pro最新モデル、プロンプトを強化
オープンソースfal-ai/flux/dev12B パラメーター、高品質
高速な反復fal-ai/flux/schnell4ステップ生成
予算重視fal-ai/fast-sdxl画像あたりのコストが低い
超高速fal-ai/sdxl-turbo1ステップ
カスタムスタイルfal-ai/flux-loraLoRA に対応
画像内のテキストfal-ai/ideogramタイポグラフィに特化
デザイン素材fal-ai/recraft-v3ベクタースタイルの出力
写実的fal-ai/flux-realismリアリズムに最適化

ベストプラクティス

プロンプトエンジニアリング

FLUX モデルの場合:

  • 説明を詳しく、具体的にします
  • スタイル、ライティング、構図を指定します
  • FLUX 2 Pro はプロンプトを自動で強化します(無効にするには raw: true を使用します)
  • ガイダンススケールは 3~4 が最適です

SDXL モデルの場合:

  • ネガティブプロンプトを使用します
  • プロンプトへの準拠度を高めるには、ガイダンスを高く(7~12)します
  • 品質を示すキーワード(「high quality, detailed, 8k」)を含めます
品質と速度のトレードオフ
// Quality priority
const quality = await fal.subscribe("fal-ai/flux-2-pro", {
  input: {
    prompt: "...",
    num_inference_steps: 28,
    guidance_scale: 3.5
  }
});

// Speed priority
const fast = await fal.subscribe("fal-ai/flux/schnell", {
  input: {
    prompt: "...",
    num_inference_steps: 4
  }
});

// Balance
const balanced = await fal.subscribe("fal-ai/flux/dev", {
  input: {
    prompt: "...",
    num_inference_steps: 20,
    guidance_scale: 3.5
  }
});
バッチ生成
// Generate multiple variations
const result = await fal.subscribe("fal-ai/flux/dev", {
  input: {
    prompt: "A beautiful landscape",
    num_images: 4,
    seed: 42  // Same seed = similar outputs
  }
});

// Access all images
result.images.forEach((img, i) => {
  console.log(`Image ${i + 1}: ${img.url}`);
});
再現性
// Use seed for reproducible results
const seed = 12345;

const result1 = await fal.subscribe("fal-ai/flux/dev", {
  input: { prompt: "A cat", seed }
});

const result2 = await fal.subscribe("fal-ai/flux/dev", {
  input: { prompt: "A cat", seed }
});

// result1 and result2 will be identical

コメント