<!
DOCTYPE
html>
<
html
lang
=
"zh-CN"
>
<
head
>
<
meta
charset
=
"UTF-8"
>
<
title
>AI 文生图工具</
title
>
<
style
>
body {
max-width: 800px;
margin: 20px auto;
padding: 40px 30px;
font-family: system-ui, -apple-system, sans-serif;
background: linear-gradient(135deg, #e6f7ff 0%, #f0ebff 100%);
border-radius: 24px;
box-shadow: 0 12px 40px rgba(24,144,255,0.15);
}
.control-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="text"],
input[type="number"],
textarea {
min-height: 10px;
width: 100%;
padding: 12px;
margin-bottom: 15px;
border: 2px solid #69c0ff;
border-radius: 12px;
background: rgba(255,255,255,0.95);
box-shadow: 0 4px 16px rgba(24,144,255,0.15);
transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
button {
background: linear-gradient(135deg, #1890ff, #096dd9);
color: white;
padding: 12px 24px;
border: none;
border-radius: 25px;
cursor: pointer;
font-size: 16px;
box-shadow: 0 4px 12px rgba(24,144,255,0.3);
transition: all 0.2s;
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 6px 16px rgba(24,144,255,0.4);
}
button:active {
transform: translateY(0);
}
button:disabled {
background: #d9d9d9;
cursor: not-allowed;
#preview {
margin-top: 20px;
text-align: center;
}
#imageContainer {
max-width: 100%;
margin-top: 20px;
border: 2px solid #bae7ff;
padding: 20px;
border-radius: 16px;
background: rgba(255,255,255,0.95);
box-shadow: 0 8px 32px rgba(24,144,255,0.1);
transition: transform 0.3s ease;
}
#imageContainer:hover {
transform: translateY(-4px);
}
</
style
>
</
head
>
<
body
>
<
h2
>AI 图片生成器</
h2
>
<
div
class
=
"control-group"
>
<
label
for
=
"prompt"
>提示词:</
label
>
<
textarea
id
=
"prompt"
placeholder
=
"请输入图片描述"
rows
=
"4"
></
textarea
>
</
div
>
<
div
class
=
"control-group"
>
<
label
for
=
"width"
>宽度:</
label
>
<
input
type
=
"number"
id
=
"width"
value
=
"1024"
min
=
"100"
max
=
"2048"
>
</
div
>
<
div
class
=
"control-group"
>
<
label
for
=
"height"
>高度:</
label
>
<
input
type
=
"number"
id
=
"height"
value
=
"576"
min
=
"100"
max
=
"2048"
>
</
div
>
<
div
class
=
"control-group"
>
<
label
for
=
"seed"
>随机种子:</
label
>
<
input
type
=
"number"
id
=
"seed"
value
=
"100"
min
=
"0"
>
</
div
>
<
button
>生成图片</
button
>
<
div
id
=
"preview"
>
<
h3
>图片预览</
h3
>
<
div
id
=
"imageContainer"
>
<
img
id
=
"generatedImage"
style
=
"max-width: 100%"
>
</
div
>
</
div
>
<
script
>
function generateImage() {
const prompt = document.getElementById('prompt').value;
const width = document.getElementById('width').value;
const height = document.getElementById('height').value;
const seedInput = document.getElementById('seed');
let seed = parseInt(seedInput.value);
if (!prompt) {
alert('请输入提示词');
return;
}
const encodedPrompt = encodeURIComponent(prompt);
const imageUrl = `[url]https://image.pollinations.ai/prompt/[/url]${encodedPrompt}?width=${width}&height=${height}&seed=${seed}&model=flux&nologo=true`;
seedInput.value = seed + 1;
document.getElementById('generatedImage').src = imageUrl;
}
</
script
>
</
body
>
</
html
>