Skip to main content

Stable Image - Image Mask Editor

Edit and transform specific areas of images using mask-based selection with Stability AI's advanced inpainting technology. Precisely control which parts of an image to modify by providing a mask, then describe what you want to see in those areas. The AI intelligently generates new content that seamlessly blends with the existing image.

Endpoint

Request Headers

FieldValue
API-KEY<api-key>
Content-Typeapplication/json

Parameters

ParameterTypeRequiredDescription
typestringYesFeature type identifier. Must be IMAGE_INPAINTER
modelstringYesAI model identifier. Must be stable-image
promptObjectobjectYesConfiguration object containing all image editing parameters

Prompt Object Parameters

ParameterTypeRequiredDescriptionDefault
imageUrlstringYesPath to the source image to be edited-
maskUrlstringYesPath to the mask image defining areas to edit (white=edit, black=preserve)-
promptstringYesDescription of what to generate in the masked areas-
output_formatstringNoOutput format for the processed imagepng

Supported Output Formats

FormatDescriptionBest For
pngHigh quality lossless format with transparency supportProfessional use, detailed editing, archival quality
jpegCompressed format suitable for photographsWeb optimization, social media, smaller file sizes
webpModern format with superior compressionWeb applications, modern browsers

Mask Image Requirements

RequirementDescription
FormatPNG, JPEG, or WebP formats supported
DimensionsMust match the source image dimensions exactly
Color SchemeWhite areas = regions to edit, Black areas = regions to preserve
Grayscale SupportGray values for partial editing/blending effects

Prompt Guidelines for Best Results

GuidelineDescriptionExample
Be DescriptiveUse detailed, vivid descriptions"a bright red rose with water droplets" instead of "flower"
Style ConsistencyMatch the style of the original image"realistic sunset" for photos, "cartoon style tree" for illustrations
Contextual FitEnsure the prompt fits the scene context"wooden dining chair" in a kitchen scene
Lighting AwarenessConsider the lighting in the original image"softly lit candle" for warm indoor scenes

Code Examples

curl --location 'https://api.1min.ai/api/features' \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"type": "IMAGE_INPAINTER",
"model": "stable-image",
"promptObject": {
"imageUrl": "development/images/2025_02_16_15_35_49_260_banana.jpg",
"maskUrl": "development/images/2025_02_16_15_36_38_743_image.png",
"prompt": "a ripe red apple with glossy skin",
"output_format": "png"
}
}'

Interactive Playground

API Playground

https://api.1min.ai/api/features
Path to the source image to be edited
Path to the mask image (white areas will be edited)
Describe what you want to generate in the masked areas
Format of the output image with edits applied

Generated cURL Command:

curl -X POST "https://api.1min.ai/api/features" \
-H "API-KEY: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{
"type": "IMAGE_INPAINTER",
"model": "stable-image",
"promptObject": {
"imageUrl": "development/images/2025_02_16_15_35_49_260_banana.jpg",
"maskUrl": "development/images/2025_02_16_15_36_38_743_image.png",
"prompt": "a ripe red apple with glossy skin",
"output_format": "png"
}
}'

Response Format

{
"aiRecord": {
"uuid": "i1m2e3d4-v5e6-7890-abcd-ef1234567890",
"userId": "user-12345",
"teamId": "team-67890",
"teamUser": {
"teamId": "team-67890",
"userId": "user-12345",
"userName": "John Doe",
"userAvatar": "https://example.com/avatar.jpg",
"status": "ACTIVE",
"role": "ADMIN",
"creditLimit": 100000000,
"usedCredit": 28000,
"createdAt": "2025-01-01T00:00:00.000Z",
"createdBy": "SYSTEM",
"updatedAt": "2025-01-15T16:00:00.000Z",
"updatedBy": "SYSTEM"
},
"model": "stable-image",
"type": "IMAGE_INPAINTER",
"metadata": null,
"rating": null,
"feedback": null,
"conversationId": null,
"status": "SUCCESS",
"createdAt": "2025-01-15T16:00:00.000Z",
"aiRecordDetail": {
"promptObject": {
"imageUrl": "development/images/2025_02_16_15_35_49_260_banana.jpg",
"maskUrl": "development/images/2025_02_16_15_36_38_743_image.png",
"prompt": "a ripe red apple with glossy skin",
"output_format": "png"
},
"resultObject": [
"development/images/2025_01_15_16_00_30_001_mask_edited.png"
],
"responseObject": {}
},
"additionalData": null,
"temporaryUrl": "https://s3.us-east-1.amazonaws.com/asset.1min.ai/development/images/2025_01_15_16_00_30_001_mask_edited.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=EXAMPLE_CREDENTIAL&X-Amz-Date=20250115T160000Z&X-Amz-Expires=604800&X-Amz-Signature=example_signature&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject"
}
}

Use Cases

Creative Photo Editing & Enhancement

  • Object Replacement: Replace specific items in photos with different objects or styles
  • Background Elements: Add or modify background elements like changing sky, adding trees, or replacing buildings
  • Color Correction: Change colors of specific objects while preserving the rest of the image
  • Style Consistency: Match new elements to the existing image style and lighting
  • Artistic Modifications: Transform realistic objects into stylized or artistic versions

E-commerce & Product Photography

  • Product Customization: Show different product variations by editing specific features
  • Environment Enhancement: Improve product settings by editing backgrounds or surrounding elements
  • Damage Repair: Fix scratches, dents, or imperfections in product photos
  • Seasonal Updates: Modify product presentations for different seasons or occasions
  • Brand Consistency: Ensure consistent styling across product catalogs

Portrait & Fashion Photography

  • Wardrobe Changes: Modify clothing colors, patterns, or styles in fashion shoots
  • Accessory Updates: Add, remove, or change accessories like jewelry, bags, or shoes
  • Background Replacement: Change portrait backgrounds while maintaining natural lighting
  • Hair and Makeup: Experiment with different hair colors or makeup styles
  • Style Matching: Ensure edited elements match the original photography style

Interior & Architectural Design

  • Furniture Visualization: Replace or add furniture pieces to show different design options
  • Color Scheme Testing: Change wall colors, flooring, or decor to test design concepts
  • Lighting Scenarios: Modify lighting conditions or add light fixtures
  • Renovation Planning: Visualize changes before implementing physical modifications
  • Client Presentations: Show multiple design options using the same base image

Marketing & Advertising

  • Campaign Customization: Adapt advertising images for different markets or demographics
  • Seasonal Marketing: Update promotional images with seasonal elements or themes
  • A/B Testing: Create variations of marketing materials to test effectiveness
  • Localization: Customize images for different regions or cultural contexts
  • Brand Integration: Add or modify brand elements in existing imagery

Social Media & Content Creation

  • Content Variations: Create multiple versions of images for different social platforms
  • Trend Integration: Update images to match current social media trends
  • Engagement Optimization: Modify images to increase visual appeal and engagement
  • Personal Branding: Customize images to match personal or brand aesthetics
  • Story Enhancement: Add visual elements that support narrative content

Tips for Best Results

  1. Mask Creation Excellence: Create precise masks for optimal results

    • High Contrast: Use pure white (#FFFFFF) for areas to edit, pure black (#000000) for areas to preserve
    • Clean Edges: Ensure mask boundaries are clean and well-defined
    • Accurate Selection: Carefully trace the boundaries of objects you want to edit
    • Edge Softening: Use slight feathering for natural blending between edited and preserved areas
  2. Prompt Engineering: Write effective prompts for better generation

    • Descriptive Details: Include specific details about texture, color, lighting, and style
    • Style Matching: Reference the original image style (e.g., "photorealistic", "artistic", "vintage")
    • Contextual Awareness: Ensure prompts fit the scene's context and perspective
    • Lighting Consistency: Mention lighting conditions that match the original image
  3. Image Quality Optimization: Use high-quality source materials

    • High Resolution: Higher resolution images provide better detail and editing quality
    • Good Lighting: Well-lit images help AI understand context and generate consistent results
    • Sharp Focus: Clear, focused images produce more accurate and detailed edits
    • Minimal Compression: Use uncompressed or lightly compressed source images when possible
  4. Technical Considerations: Optimize for processing efficiency

    • Mask Precision: Accurate masks reduce processing time and improve results
    • Appropriate Sizing: Match mask dimensions exactly to source image dimensions
    • Format Selection: Choose PNG for transparency needs, JPEG for smaller files
    • Iterative Refinement: Make small adjustments in multiple steps for complex edits
  5. Creative Workflow: Maximize creative potential

    • Reference Gathering: Collect reference images to guide prompt creation
    • Style Consistency: Maintain consistent artistic style throughout the editing process
    • Context Preservation: Ensure edited elements fit naturally within the scene
    • Multiple Iterations: Experiment with different prompts to achieve desired results
  6. Advanced Techniques: Professional-level editing approaches

    • Layered Editing: Edit different areas separately for complex modifications
    • Lighting Analysis: Study original lighting to ensure realistic integration
    • Perspective Matching: Consider camera angle and perspective when adding new elements
    • Color Harmony: Ensure new elements complement the existing color palette

Mask Creation Tools

  • Adobe Photoshop: Industry-standard with advanced selection and masking tools
  • GIMP: Free alternative with comprehensive masking capabilities
  • Canva: User-friendly online tool for basic mask creation
  • Paint.NET: Windows-based tool with good selection features
  • Procreate: iPad app excellent for precise digital masking

Mask Quality Checklist

  • Exact Dimensions: Mask matches source image size perfectly
  • High Contrast: Clear distinction between edit areas (white) and preserve areas (black)
  • Clean Boundaries: Smooth, well-defined edges around objects
  • Appropriate Coverage: All target areas properly marked for editing
  • Edge Quality: Suitable edge treatment (hard or soft) for the editing type