POST
javascript
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); } })();
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


promptstr *

Text prompt describing the desired image edit or generation


image_1image ( default: 1 )

Primary input image (URL or base64)


image_2image ( default: 1 )

Secondary input image (URL or base64)


image_3image ( default: 1 )

Tertiary input image (URL or base64)


loraenum:str ( default: face_to_portrait )

Pre-configured LoRA model to apply

Allowed values:


lora_2_urlstr ( default: 1 )

Additional LoRA model URL. Public direct url or huggingface url pointing to the lora file


lora_3_urlstr ( default: 1 )

Additional LoRA model URL. Public direct url or huggingface url pointing to the lora file


aspect_ratioenum:str ( default: 4:5 )

Output image aspect ratio

Allowed values:


seedint ( default: 1 )

Random seed for reproducibility. Use -1 for random

min : -1,

max : 2147483647


image_formatenum:str ( default: webp )

Output image format

Allowed values:


qualityint ( default: 95 )

Output image quality (1-100)

min : 1,

max : 100


base64bool ( default: 1 )

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.

Qwen-Image-Edit-F2P: Face-to-Portrait Image Generation Model

Edited by Segmind Team on November 26, 2025.


What is Qwen-Image-Edit-F2P?

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.


Key Features of Qwen-Image-Edit-F2P

  • Identity-Preserving Generation: It maintains facial features and identity across different portrait styles and contexts.
  • Face Auto-Cropping: It is integrated with a face detector that automatically handles input preparation.
  • Multi-Image Support: It is designed to accept up to three reference images for complex edits and blending.
  • LoRA Integration: It has a built-in "face_to_portrait" LoRA with support for custom LoRA URLs for style customization.
  • Flexible Output Control: It supports 11 aspect ratio options, including input-matching mode.
  • Reproducible Results: Its seed control ensures consistent outputs across generations.
  • Production-Ready Formats: It also supports JPEG, PNG, and WebP with adjustable quality settings.

Best Use Cases

  • 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.

Prompt Tips and Output Quality

  • 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.

FAQs

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.