Midjourney-Inpainting
curl --request POST \
--url https://api.highwayapi.ai/v3/async/mj-inpaint \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"image_no": 123,
"task_id": "<string>",
"remix_prompt": "<string>",
"mask": {
"url": "<string>",
"areas": [
{
"points": [
123
],
"width": 123,
"height": 123
}
]
},
"area": {
"points": [
123
],
"width": 123,
"height": 123
}
}
'import requests
url = "https://api.highwayapi.ai/v3/async/mj-inpaint"
payload = {
"image_no": 123,
"task_id": "<string>",
"remix_prompt": "<string>",
"mask": {
"url": "<string>",
"areas": [
{
"points": [123],
"width": 123,
"height": 123
}
]
},
"area": {
"points": [123],
"width": 123,
"height": 123
}
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
image_no: 123,
task_id: '<string>',
remix_prompt: '<string>',
mask: {url: '<string>', areas: [{points: [123], width: 123, height: 123}]},
area: {points: [123], width: 123, height: 123}
})
};
fetch('https://api.highwayapi.ai/v3/async/mj-inpaint', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.highwayapi.ai/v3/async/mj-inpaint",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'image_no' => 123,
'task_id' => '<string>',
'remix_prompt' => '<string>',
'mask' => [
'url' => '<string>',
'areas' => [
[
'points' => [
123
],
'width' => 123,
'height' => 123
]
]
],
'area' => [
'points' => [
123
],
'width' => 123,
'height' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.highwayapi.ai/v3/async/mj-inpaint"
payload := strings.NewReader("{\n \"image_no\": 123,\n \"task_id\": \"<string>\",\n \"remix_prompt\": \"<string>\",\n \"mask\": {\n \"url\": \"<string>\",\n \"areas\": [\n {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n ]\n },\n \"area\": {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.highwayapi.ai/v3/async/mj-inpaint")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"image_no\": 123,\n \"task_id\": \"<string>\",\n \"remix_prompt\": \"<string>\",\n \"mask\": {\n \"url\": \"<string>\",\n \"areas\": [\n {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n ]\n },\n \"area\": {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/v3/async/mj-inpaint")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"image_no\": 123,\n \"task_id\": \"<string>\",\n \"remix_prompt\": \"<string>\",\n \"mask\": {\n \"url\": \"<string>\",\n \"areas\": [\n {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n ]\n },\n \"area\": {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>"
}Bilder
Midjourney-Inpainting
POST
/
v3
/
async
/
mj-inpaint
Midjourney-Inpainting
curl --request POST \
--url https://api.highwayapi.ai/v3/async/mj-inpaint \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"image_no": 123,
"task_id": "<string>",
"remix_prompt": "<string>",
"mask": {
"url": "<string>",
"areas": [
{
"points": [
123
],
"width": 123,
"height": 123
}
]
},
"area": {
"points": [
123
],
"width": 123,
"height": 123
}
}
'import requests
url = "https://api.highwayapi.ai/v3/async/mj-inpaint"
payload = {
"image_no": 123,
"task_id": "<string>",
"remix_prompt": "<string>",
"mask": {
"url": "<string>",
"areas": [
{
"points": [123],
"width": 123,
"height": 123
}
]
},
"area": {
"points": [123],
"width": 123,
"height": 123
}
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
image_no: 123,
task_id: '<string>',
remix_prompt: '<string>',
mask: {url: '<string>', areas: [{points: [123], width: 123, height: 123}]},
area: {points: [123], width: 123, height: 123}
})
};
fetch('https://api.highwayapi.ai/v3/async/mj-inpaint', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.highwayapi.ai/v3/async/mj-inpaint",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'image_no' => 123,
'task_id' => '<string>',
'remix_prompt' => '<string>',
'mask' => [
'url' => '<string>',
'areas' => [
[
'points' => [
123
],
'width' => 123,
'height' => 123
]
]
],
'area' => [
'points' => [
123
],
'width' => 123,
'height' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.highwayapi.ai/v3/async/mj-inpaint"
payload := strings.NewReader("{\n \"image_no\": 123,\n \"task_id\": \"<string>\",\n \"remix_prompt\": \"<string>\",\n \"mask\": {\n \"url\": \"<string>\",\n \"areas\": [\n {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n ]\n },\n \"area\": {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.highwayapi.ai/v3/async/mj-inpaint")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"image_no\": 123,\n \"task_id\": \"<string>\",\n \"remix_prompt\": \"<string>\",\n \"mask\": {\n \"url\": \"<string>\",\n \"areas\": [\n {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n ]\n },\n \"area\": {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/v3/async/mj-inpaint")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"image_no\": 123,\n \"task_id\": \"<string>\",\n \"remix_prompt\": \"<string>\",\n \"mask\": {\n \"url\": \"<string>\",\n \"areas\": [\n {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n ]\n },\n \"area\": {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>"
}Verwenden Sie die Midjourney-Inpainting-Funktion, um bestimmte Bereiche eines bereits generierten Bildes neu zu zeichnen. Der neu zu zeichnende Bereich kann über Polygonbereiche oder ein Schwarz-Weiß-Maskenbild angegeben werden. Diese Schnittstelle arbeitet asynchron; der Client muss das endgültige Generierungsergebnis über die task_id abfragen.
Anfrageheader
string
erforderlich
Enumerationswert:
application/jsonstring
erforderlich
Bearer-Authentifizierungsformat: Bearer {{API Key}}.
Anfragetext
integer
erforderlich
Bildnummer, mit der das Bild angegeben wird, für das ein Bereich neu gezeichnet werden soll.Wertebereich: 0~3
string
erforderlich
Eindeutiger Bezeichner der ursprünglichen Bildgenerierungsaufgabe.
string
Prompt für den neu zu zeichnenden Bereich, der den gewünschten Inhalt des Inpainting-Bereichs beschreibt.Längenbeschränkung: 1-8192 Zeichen.
object
erforderlich
Konfiguration des Zeichenbereichs, ersetzt den Parameter area und unterstützt Inpainting mehrerer Bereiche. Entweder areas oder url muss angegeben werden.
Anzeigen properties
Anzeigen properties
string
Gibt Polygonbereiche über ein binäres Schwarz-Weiß-Bild an; mehrere Bereiche werden unterstützt. Weiße Bereiche sind die neu zu zeichnenden Bereiche.
object[]
Array von Polygonbereichen; die Angabe mehrerer Bereiche wird unterstützt.
object
erforderlich
Konfiguration eines einzelnen Polygonbereichs (alternativ zum Parameter mask zu verwenden).
Antwortparameter
string
erforderlich
Die task_id der asynchronen Aufgabe. Sie sollten diese task_id verwenden, um die API zum Abfragen des Aufgabenergebnisses aufzurufen und das Generierungsergebnis abzurufen.
⌘I