Pollinations.AI 筆記
免費開源的 AI 圖像生成平台,無需註冊,即刻開始創作
100% 免費
隱私保護
開源專案
AI同心圓愛教育聯盟
快速入門 - 3 分鐘學會使用
1
輸入描述
用自然語言描述你想要的圖像
2
設定參數
選擇尺寸、風格和其他選項
3
獲得結果
立即生成高品質 AI 圖像
立即體驗 Live Demo
基本 URL 結構理解
標準 API 格式
https://image.pollinations.ai/prompt/{您的描述}?參數1=值1&參數2=值2
🔗
基礎 URL
固定的 API 端點地址
https://image.pollinations.ai/prompt/
💬
提示詞
您的圖像描述文字
A cat riding a bicycle
⚙️
參數設定
自訂尺寸、風格等選項
?width=512&height=512
實際範例解析
https://image.pollinations.ai/prompt/A cat riding a bicycle?width=512&height=512&seed=1024&nologo=true&enhance=true
提示詞: "A cat riding a bicycle"
寬度: 512 像素
高度: 512 像素
寬度: 512 像素
高度: 512 像素
種子值: 1024 (可重現結果)
無水印: 是
增強效果: 是
無水印: 是
增強效果: 是
完整參數指南
尺寸設定
width
16-2048
height
16-2048
常用尺寸:
• 512×512 (正方形)
• 1024×768 (4:3)
• 1920×1080 (16:9)
• 768×1024 (3:4)
種子值控制
seed
整數值
用途說明:
- • 相同 seed = 相同結果
- • 不設定 = 隨機生成
- • -1 = 強制隨機
- • 用於 A/B 測試比較
效果增強
enhance
true/false
功能說明:
- • 提升圖像細節
- • 增強色彩飽和度
- • 改善整體品質
- • 輕微增加生成時間
隱私與安全
nologo
移除水印
private
私人模式
safe
安全過濾
程式碼範例與整合
基礎 JavaScript 實現
// 基本圖像生成函數
function generateImage(prompt, options = {}) {
const baseUrl = 'https://image.pollinations.ai/prompt/';
const encodedPrompt = encodeURIComponent(prompt);
const params = new URLSearchParams({
width: options.width || 1024,
height: options.height || 1024,
model: options.model || 'flux',
enhance: options.enhance || false,
nologo: options.nologo || true,
...options
});
return `${baseUrl}${encodedPrompt}?${params}`;
}
// 使用範例
const imageUrl = generateImage(
"一隻可愛的小貓在花園裡玩耍",
{
width: 768,
height: 768,
model: 'flux-anime',
enhance: true
});
console.log(imageUrl);
進階 React Hook
// React Hook 實現
import { useState, useEffect } from 'react';
function usePollinations(prompt, options) {
const [imageUrl, setImageUrl] = useState(null);
const [loading, setLoading] = useState(false);
useEffect(() => {
if (!prompt) return;
setLoading(true);
const url = generateImage(prompt, options); // Assuming generateImage is defined globally or imported
setImageUrl(url);
setLoading(false);
}, [prompt, options]);
return { imageUrl, loading };
}
// 組件中使用
function ImageGenerator() {
const [prompt, setPrompt] = useState('');
const { imageUrl, loading } = usePollinations(prompt, {
width: 512,
height: 512,
model: 'flux'
});
return (
<div>
<input
value={prompt}
onChange={(e) => setPrompt(e.target.value)}
placeholder="輸入圖像描述"
/>
{loading && <p>生成中...</p>}
{imageUrl && <img src={imageUrl} alt="Generated" />}
</div>
);
}
互動工具與測試
URL 建構器
參數測試器
測試結果:
批量生成器
常見問題與故障排除
常見問題
圖像載入失敗
可能原因與解決方案:
- • 網路連接問題 - 檢查網路狀況
- • 提示詞包含敏感內容 - 修改描述
- • 服務器暫時繁忙 - 稍後重試
- • URL 格式錯誤 - 檢查參數設定
生成速度緩慢
優化建議:
- • 使用 turbo 模型快速生成
- • 降低圖像解析度
- • 簡化提示詞描述
- • 避免尖峰使用時段
生成結果不符預期
改善方法:
- • 使用更具體的描述
- • 選擇合適的模型風格
- • 調整圖像比例
- • 嘗試不同的種子值
故障排除工具
URL 驗證器
連接測試
提示詞分析
性能優化技巧
⚡
快速生成
- • model=turbo
- • 512×512 解析度
- • 簡短提示詞
- • 關閉 enhance
🎨
高品質輸出
- • model=flux-pro
- • 1920×1080 解析度
- • enhance=true
- • 詳細提示詞
🔄
一致性控制
- • 固定 seed 值
- • 相同參數設定
- • 標準化提示詞
- • 批量處理
相關資源與連結
快速參考
基本 API 端點
圖像生成: https://image.pollinations.ai/prompt/{prompt}
文本生成: https://text.pollinations.ai/{prompt}
音頻生成: https://text.pollinations.ai/{prompt}?model=openai-audio
常用參數組合
高品質: model=flux-pro&enhance=true
快速生成: model=turbo&width=512&height=512
無水印: nologo=true&private=true