1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const axios = require('axios');
const fs = require('fs');
const path = require('path');
async function toB64(imgPath) {
const data = fs.readFileSync(path.resolve(imgPath));
return Buffer.from(data).toString('base64');
}
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/qwen-image-edit-plus-face-to-portrait";
const data = {
"prompt": "Generate a full-body portrait of this man",
"image_1": "toB64('https://segmind-resources.s3.amazonaws.com/input/3781650d-d860-4be1-977d-a101b7f47bc1-black-man-image.jpeg')",
"image_2": "toB64('')",
"image_3": "toB64('')",
"lora": "face_to_portrait",
"aspect_ratio": "4:5",
"seed": 87568756,
"image_format": "webp",
"quality": 95,
"base64": false
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();Text prompt describing the desired image edit or generation
Primary input image (URL or base64)
Secondary input image (URL or base64)
Tertiary input image (URL or base64)
Pre-configured LoRA model to apply
Allowed values:
Additional LoRA model URL. Public direct url or huggingface url pointing to the lora file
Additional LoRA model URL. Public direct url or huggingface url pointing to the lora file
Output image aspect ratio
Allowed values:
Random seed for reproducibility. Use -1 for random
min : -1,
max : 2147483647
Output image format
Allowed values:
Output image quality (1-100)
min : 1,
max : 100
Return image as base64 encoded string
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Edited by Segmind Team on November 26, 2025.
Qwen-Image-Edit-F2P is an AI-powered model developed by DiffSynth-Studio that converts cropped facial inputs into complete, high-resolution portrait photographs. It excels in face-controlled generation by using a single facial image to create full-body or upper-body portraits, ensuring the person’s facial identity and features are perfectly retained to produce photorealistic portraits. It utilizes the Qwen-Image-Edit architecture and combines multiple integrated components, making it a reliable option for creative portrait synthesis, character design, and personalized media creation.
Qwen-Image-Edit-F2P is also integrated with built-in face detection that supports automatic cropping to simplify workflows for developers working with diverse image inputs. Therefore, Qwen-Image-Edit-F2P ensures consistent and lifelike face-to-portrait transformations in various creative tasks, including building a profile picture generator, designing a virtual character, or enhancing portraits.
Content Creation & Marketing: It is perfect to generate professional headshots, social media avatars, and brand ambassador imagery from simple face photos.
Gaming & Entertainment: It can be used to create character portraits for games, visual novels, or interactive fiction while maintaining character identity.
E-commerce & Fashion: It is capable of producing model shots and lookbook imagery by transforming face references into full portraits wearing different styles.
Social Applications: It can design power profile picture generators, avatar creators, and personalized virtual identity tools.
Creative Studios: It enables rapid prototyping of character designs and portrait concepts for concept art workflows.
Effective Prompting: Use descriptive prompts that also concisely specify portrait style, lighting, and context. Example: "Professional headshot with soft studio lighting, corporate attire, neutral background" works better than generic descriptions.
Image Input Best Practices: Provide clear, well-lit facial images for superior results. The model accepts multiple images, so use image_2 and image_3 for reference poses or style blending. Additionally, higher resolution inputs with well-cropped faces will render precise detail.
Quality Parameters: Set quality between 85-100 for production workflow, while using aspect_ratio "match_input_image" to preserve original proportions, or choose specific ratios like "2:3" for standard portrait formats.
Seed Control: Lock the seed value once you achieve desired results to maintain consistency across iterations while adjusting only the prompt.
LoRA Customization: The default "face_to_portrait" LoRA produces photorealistic portraits; experiment with custom LoRA URLs (lora_2_url, lora_3_url) to add a touch of artistic styles or specific aesthetic modifications.
Is Qwen-Image-Edit-F2P open-source?
The Qwen-Image-Edit-F2P is available through Segmind's API platform. You can further check DiffSynth-Studio's repository for licensing details on the base architecture.
How does this differ from standard text-to-image models?
This model specializes in "face-controlled generation" to preserve facial identity while creating full portraits, making it superior for applications requiring person-specific outputs.
What aspect ratio should I use for social media profiles?
Use "1:1" for Instagram/ X avatars; "2:3" for LinkedIn profiles; and "9:16" for TikTok or vertical platform content.
Can I generate images without providing a face photo?
No, Qwen-Image-Edit-F2P requires at least one facial image input (image_1) to generate portraits. It is optimized for "face-to-portrait" transformation, in addition to the text-only generation.
What parameters affect output quality most?
Image input quality is vital for high-quality results, so it is recommended to use clear, well-lit faces for the best results. The "quality" parameter (recommended: 90-95) and prompt specificity directly impact final fidelity.
How do I ensure consistent results across multiple generations?
Set a fixed seed value and maintain the same prompt structure to generate reproducible outputs while allowing incremental prompt refinements.