Hair Style

Action ID: hair_style

Description

Transform hair styles in portrait images using AI. This node applies realistic hair style changes to photos based on text descriptions, enabling virtual hair makeovers and style previews.

Connection

Name
Description
Required
Category

PixelML Connection

The PixelML connection to call PixelML API.

True

pixelml

Input Parameters

Name
Type
Required
Default
Description

prompt

string

-

Description of the desired hair style transformation

image_url

string

-

URL of the input portrait image. Supported formats: PNG, JPEG, JPG, WebP

View JSON Schema
{
  "description": "Hair style node input.",
  "properties": {
    "prompt": {
      "title": "Prompt",
      "type": "string"
    },
    "image_url": {
      "title": "Image url",
      "type": "string"
    }
  },
  "required": [
    "prompt",
    "image_url"
  ],
  "title": "HairStyleNodeInput",
  "type": "object"
}

Output Parameters

Name
Type
Description

image

string

URL of the generated image with the new hair style applied

View JSON Schema
{
  "description": "Hair style node output.",
  "properties": {
    "image": {
      "title": "Image output",
      "type": "string"
    }
  },
  "required": [
    "image"
  ],
  "title": "HairStyleNodeOutput",
  "type": "object"
}

How It Works

This node uses advanced AI models through PixelML to analyze the input portrait image and apply the requested hair style transformation. The AI identifies facial features and hair regions, then generates a realistic modified version with the new hair style while preserving other facial characteristics, lighting, and image quality. The transformation is guided by your text prompt describing the desired hair style.

Usage Examples

Example 1: Long to Short Hair Transformation

Input:

prompt: "short pixie cut with side-swept bangs, platinum blonde"
image_url: "https://example.com/images/portrait-long-hair.jpg"

Output:

image: "https://pixelml.com/output/hair-style-abc123.png"

(Returns image with short pixie cut applied)

Example 2: Color and Style Change

Input:

prompt: "shoulder-length wavy hair, auburn red color with highlights"
image_url: "https://example.com/images/customer-photo.jpg"

Output:

image: "https://pixelml.com/output/hair-style-def456.png"

(Returns image with wavy auburn hair)

Example 3: Professional Styling

Input:

prompt: "sleek straight hair in a low bun, professional business style, dark brown"
image_url: "https://example.com/images/headshot.jpg"

Output:

image: "https://pixelml.com/output/hair-style-ghi789.png"

(Returns image with professional bun hairstyle)

Common Use Cases

  • Virtual Hair Salon Try-On: Let customers preview hair styles before booking salon appointments

  • E-commerce Hair Product Demos: Show how hair products or extensions would look on customers

  • Beauty App Features: Integrate virtual hair makeover capabilities into beauty and fashion apps

  • Marketing Campaigns: Create diverse hair style variations for advertising materials

  • Before/After Galleries: Generate transformation previews for hair salons and stylists

  • Personal Style Exploration: Help users experiment with different hair styles and colors virtually

  • Character Design: Create varied character appearances for games, animations, or digital avatars

Error Handling

Error Type
Cause
Solution

Invalid Image URL

Image URL is inaccessible or malformed

Verify the URL is publicly accessible and properly formatted

Unsupported Image Format

Image is not in PNG, JPEG, JPG, or WebP format

Convert the image to a supported format before processing

Face Not Detected

No face found in the input image

Use a clear portrait image with a visible face and hair region

Image Too Large

Input image exceeds size limits

Resize the image to recommended dimensions (typically under 4096x4096)

Empty Prompt

Prompt parameter is empty or missing

Provide a clear description of the desired hair style

API Connection Failed

PixelML connection is invalid or expired

Verify your PixelML credentials and connection status

Processing Timeout

Hair style transformation took too long

Retry with a smaller image or simplify the transformation request

Notes

  • Image Quality: Use high-resolution portrait images with clear facial features for best results. Images should be well-lit and in focus.

  • Prompt Clarity: Be specific in your prompts. Include details like length (short, medium, long), style (curly, straight, wavy), and color for accurate transformations.

  • Face Positioning: The subject's face should be clearly visible and facing forward. Profile or angled shots may produce less accurate results.

  • Realistic Expectations: While AI generates impressive results, extreme transformations may require multiple iterations to achieve desired outcomes.

  • Color Descriptions: Use common color terms (blonde, brunette, auburn, platinum) rather than hex codes for better AI interpretation.

  • Multiple Features: You can specify multiple hair characteristics in one prompt (e.g., "long curly blonde hair with layers and highlights").

  • Image Format: Output is typically provided in PNG format for best quality. The URL is temporary and should be saved if needed long-term.

  • Processing Time: Hair style transformations typically take 10-30 seconds depending on image complexity and requested changes.

Last updated

Was this helpful?