Home API Sketch to Image API

AI Sketch To Image API

AI Sketch to Image API converts simple sketches into detailed, realistic images, bringing concepts to life effortlessly.

Tree sketch transformed into a realistic render using LightX AI sketch-to-photo API

Transform Your Ideas with These Creative Applications

Transform basic product sketches into detailed images for quick concept visualization.

Easy Integration with Popular Frameworks
Easily integrate our API with CSS, React, Tailwind, JS, and Python for versatile and powerful applications.
import requests

url = 'https://api.lightxeditor.com/external/api/v1/sketch2image'
headers = {
'Content-Type': 'application/json',
'x-api-key': '<Insert your API Key>'  # Replace with your actual API key
}

data = {
"imageUrl": "https://example.com/your-image.jpg",  // Replace with the URL of your input image
"strength" : 0.5,  // Keep it between 0.0 to 1
"textPrompt": "YourInputPrompt",  // Replace with your specific input prompt
"styleImageUrl": "https://example.com/your-style-image.jpg",  // Replace with the URL of your input style image
"styleStrength" : 0.9  // Keep it between 0.0 to 1
}'

response = requests.post(url, headers=headers, json=data)

# Check if the request was successful
if response.status_code == 200:
print("Request was successful!")
print(response.json())
else:
print(f"Request failed with status code: {response.status_code}")
print(response.text)
const fetch = require('node-fetch');  // Only needed if you are using Node.js

const url = 'https://api.lightxeditor.com/external/api/v1/sketch2image';
const apiKey = '<Insert your API Key>';  // Replace with your actual API key

const data = {
"imageUrl": "https://example.com/your-image.jpg",  // Replace with the URL of your input image
"strength" : 0.5,  // Keep it between 0.0 to 1
"textPrompt": "YourInputPrompt",  // Replace with your specific input prompt
"styleImageUrl": "https://example.com/your-style-image.jpg",  // Replace with the URL of your input style image
"styleStrength" : 0.9  // Keep it between 0.0 to 1
};

const options = {
method: 'POST',
headers: {
    'Content-Type': 'application/json',
    'x-api-key': apiKey
},
body: JSON.stringify(data)
};

fetch(url, options)
.then(response => {
    if (!response.ok) {
        throw new Error(`Request failed with status code ${response.status}`);
    }
    return response.json();
})
.then(data => {
    console.log('Request was successful!');
    console.log(data);
})
.catch(error => {
    console.error('Error:', error);
});

}
import Foundation

// Define the URL and API key
let url = URL(string: "https://api.lightxeditor.com/external/api/v1/sketch2image")!
let apiKey = "<Insert your API Key>"  // Replace with your actual API key

// Define the request body
let requestBody: [String: Any] = [
"imageUrl": "https://example.com/your-image.jpg",  // Replace with the URL of your input image
"strength" : 0.5,  // Keep it between 0.0 to 1
"textPrompt": "YourInputPrompt",  // Replace with your specific input prompt
"styleImageUrl": "https://example.com/your-style-image.jpg",  // Replace with the URL of your input style image
"styleStrength" : 0.9  // Keep it between 0.0 to 1
]


// Convert request body to JSON data
let jsonData = try! JSONSerialization.data(withJSONObject: requestBody, options: [])

// Create the URLRequest object
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue(apiKey, forHTTPHeaderField: "x-api-key")
request.httpBody = jsonData

// Create the URLSession data task
let task = URLSession.shared.dataTask(with: request) { data, response, error in
// Handle the response
if let error = error {
    print("Error: \(error)")
    return
}

guard let httpResponse = response as? HTTPURLResponse, (200...299).contains(httpResponse.statusCode) else {
    print("Unexpected response")
    return
}

if let data = data {
    do {
        // Parse and print the JSON response
        let jsonResponse = try JSONSerialization.jsonObject(with: data, options: [])
        print("Response: \(jsonResponse)")
    } catch {
        print("Error parsing JSON: \(error)")
    }
}
}

// Start the task
task.resume()
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
import org.json.JSONObject

fun main() {
// Define the URL and API key
val url = "https://api.lightxeditor.com/external/api/v1/sketch2image"
val apiKey = "<Insert your API Key>"  // Replace with your actual API key

// Define the request body
val requestBody = JSONObject().apply {
   put("imageUrl", "https://example.com/your-image.jpg")  // Replace with the URL of your input image
    put("strength", 0.9)  // Keep it between 0.0 to 1
    put("textPrompt", "YourInputPrompt")  // Replace with your specific input prompt
    put("styleImageUrl", "https://example.com/your-style-image.jpg")  // Replace with the URL of your input style image
    put("styleStrength",  0.9)  // Keep it between 0.0 to 1
}.toString()

// Create OkHttpClient
val client = OkHttpClient()

// Create the request
val request = Request.Builder()
    .url(url)
    .post(requestBody.toRequestBody("application/json; charset=utf-8".toMediaType()))
    .addHeader("x-api-key", apiKey)
    .build()

// Make the request
client.newCall(request).execute().use { response ->
    if (!response.isSuccessful) {
        throw IOException("Unexpected code $response")
    }

    // Print the response
    val responseData = response.body?.string()
    println("Response: $responseData")
}
}
  Method- Post
curl --location 'https://api.lightxeditor.com/external/api/v1/sketch2image' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <Insert your API Key>' \
--data '{
"imageUrl": "https://example.com/your-image.jpg",  // Replace with the URL of your input image
"strength" : 0.5,  // Keep it between 0.0 to 1
"textPrompt": "YourInputPrompt",  // Replace with your specific input prompt
"styleImageUrl": "https://example.com/your-style-image.jpg",  // Replace with the URL of your input style image
"styleStrength" : 0.9  // Keep it between 0.0 to 1

}'

Choose Your Plan

Explore a variety of pricing plans designed to meet your unique requirements. Find the perfect fit and start today.

Convert Hand-drawn Image into High Quality Pictures

This tool transforms hand-drawn sketches into high-quality, realistic photos using AI. Simply upload your pencil sketch, and the AI will analyze shapes, details, and shading to generate lifelike images. Ideal for artists, designers, or hobbyists, it brings sketched concepts to life with impressive detail and color.

Evening gown sketch turned into a detailed and realistic fashion design

Turn Sketch to Photo in Hundreds of Artistic Renders

Turn your sketches into stunning artistic renders. Watch as drawings transform into 3D, photorealistic, cartoon, anime, or other creative styles. For detailed-artistic sketches, this feature perfectly captures your vision. It delivers results just as you imagined your artwork to be.

Cartoon character sketches transformed into vivid cartoon-style images

Control Image Generation Through Text Prompts

It doesn’t matter if your sketches are vague. With the prompt option, you can just upload a vague drawing and guide the AI through text descriptions. Add the details you want in your generated image. See how simple sketch outlines can turn into detailed, gorgeous art.

Landscape sketch converted into a stunning realistic scenery render

Start with Free Credits

Get started with LightX APIs today! Receive 25 free credits instantly on API signup – no credit card required

Frequently Asked Questions

The Sketch to Image API typically supports popular formats such as JPEG, PNG.

Still Unsure? Allow Us To Assist You!

Write to us and we'd love to understand your requirements

Drop an image anywhere to upload
Upload one image at a time