Input
POST https://gateway.appypie.com/img2img/getImage/v1/getSDXLImage HTTP/1.1

Content-Type: application/json
Cache-Control: no-cache

{
    "prompt": "Change to a cat",
    "inputImage": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png"
}
import urllib.request, json

try:
    url = "https://gateway.appypie.com/img2img/getImage/v1/getSDXLImage"

    hdr ={
    # Request headers
    'Content-Type': 'application/json',
    'Cache-Control': 'no-cache',
    }

    # Request body
    data =  
    data = json.dumps(data)
    req = urllib.request.Request(url, headers=hdr, data = bytes(data.encode("utf-8")))

    req.get_method = lambda: 'POST'
    response = urllib.request.urlopen(req)
    print(response.getcode())
    print(response.read())
except Exception as e:
    print(e)
// Request body
const body = {
    "prompt": "Change to a cat",
    "inputImage": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png"
};

fetch('https://gateway.appypie.com/img2img/getImage/v1/getSDXLImage', {
        method: 'POST',
        body: JSON.stringify(body),
        // Request headers
        headers: {
            'Content-Type': 'application/json',
            'Cache-Control': 'no-cache',}
    })
    .then(response => {
        console.log(response.status);
        console.log(response.text());
    })
    .catch(err => console.error(err));
curl -v -X POST "https://gateway.appypie.com/img2img/getImage/v1/getSDXLImage" -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data-raw "{
    \"prompt\": \"Change to a cat\",
    \"inputImage\": \"https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png\"
}"

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.io.UnsupportedEncodingException;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.FileInputStream;

public class HelloWorld {

  public static void main(String[] args) {
    try {
        String urlString = "https://gateway.appypie.com/img2img/getImage/v1/getSDXLImage";
        URL url = new URL(urlString);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();

        //Request headers
    connection.setRequestProperty("Content-Type", "application/json");
    
    connection.setRequestProperty("Cache-Control", "no-cache");
    
        connection.setRequestMethod("POST");

        // Request body
        connection.setDoOutput(true);
        connection
            .getOutputStream()
            .write(
             "{ \"prompt\": \"Change to a cat\", \"inputImage\": \"https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png\" }".getBytes()
             );
    
        int status = connection.getResponseCode();
        System.out.println(status);

        BufferedReader in = new BufferedReader(
            new InputStreamReader(connection.getInputStream())
        );
        String inputLine;
        StringBuffer content = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();
        System.out.println(content);

        connection.disconnect();
    } catch (Exception ex) {
      System.out.print("exception:" + ex.getMessage());
    }
  }
}


$url = "https://gateway.appypie.com/img2img/getImage/v1/getSDXLImage";
$curl = curl_init($url);

curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

# Request headers
$headers = array(
    'Content-Type: application/json',
    'Cache-Control: no-cache',
    
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

# Request body
$request_body = '{
    "prompt": "Change to a cat",
    "inputImage": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png"
}';
curl_setopt($curl, CURLOPT_POSTFIELDS, $request_body);

$resp = curl_exec($curl);
curl_close($curl);
var_dump($resp);


Output
Stable Diffusion Img2img API

Stable Diffusion Img2Img: Generate Stunning Images from Input Images and Text Prompts

meta

The Stable Diffusion Img2Img model is an advanced AI-powered tool designed to transform input images into stunning new creations based on detailed text prompts. Utilizing sophisticated image-to-image synthesis and stable diffusion techniques, allows users to modify existing visuals while preserving key elements, offering a fresh approach to image generation. This cutting-edge technology opens up a world of possibilities for artists, designers, and content creators by enabling them to explore creative avenues, enhance their work, and produce unique visuals that stand out in the crowded digital landscape.

The Stable Diffusion Img2Img API makes it easy for users to integrate this powerful functionality into their applications, providing seamless image modification capabilities. Through the img2img stable diffusion process, users can transform an input image based on specific text instructions, resulting in a high-quality output that captures their creative vision. Whether you’re applying distinct artistic styles, refining your artwork, or experimenting with new concepts, this tool offers endless creative potential. It’s a valuable resource for developers, artists, and designers seeking precision, flexibility, and ease of use in bringing their ideas to life.

How to Generate Images Using the Stable Diffusion Img2Img API

To successfully generate images using the Stable Diffusion Img2Img API, follow these detailed steps to ensure proper execution and optimal results.

Obtain API Key Access

First, acquire access to the Stable Diffusion Img2Img API from the Appy Pie Endpoint. You'll need an API key for authentication, which will enable you to send requests to the API.

Set Up Environment and Prompts

Specify the key parameters when making an API request, such as image URL, prompt, negative prompts, etc., to get desired responses. Ensure that you’ve set up your environment properly, including the necessary libraries or tools for making API requests, such as Python or JavaScript, and configured the right parameters.

Send API Post Request

Use a programming language of your choice, such as Python or JavaScript, to send a POST request to the API endpoint with the parameters above.

Process and Retrieve the Image

After submitting your request, the API will return a new image based on the input and prompts you provided. You can then retrieve the image URL and either save or display the generated image as needed.

Use Cases of Stable Diffusion Img2Img API

The Stable Diffusion Img2Img API offers a wide range of versatile applications, allowing users to generate and modify high-quality images based on image and text inputs. Here are some key use cases for the Stable Diffusion Img2Img API:

Graphic Design and Artistic Applications

The Stable Diffusion Img2Img API is a powerful tool for graphic design and artistic purposes. Designers can leverage this advanced image-to-image model to quickly refine and enhance images for various creative projects. Whether it's digital art, promotional materials, or branding assets, the API ensures consistent image quality. With its ability to adjust colors, enhance details, and apply specific artistic styles, it becomes an indispensable resource for creative professionals looking to produce polished and visually appealing work.

Image Generation

Perfect for image generation, the Stable Diffusion Img2Img API simplifies the process of editing and creating high-quality images for social media, advertising, and marketing purposes. By refining images based on specific text prompts and styles, the API enables quick and efficient text-to-image generation, streamlining the creative process and making it ideal for producing visually engaging content.

Research and Development

In the fields of image processing, computer vision, and machine learning, researchers can use the Stable Diffusion Img2Img API to create high-quality images for testing, validation, and experimentation. The API helps ensure accuracy by generating precise and reliable images, making it an essential tool for research and development in these domains.

Education and Training

The Stable Diffusion Img2Img API is also valuable in educational settings for teaching concepts related to image processing, computer vision, and machine learning. By allowing students to interact with the API, educators can provide practical, hands-on learning experiences that deepen their understanding of image refinement techniques.

Image Editing and Enhancement

Photographers and image editors can benefit from the Stable Diffusion Img2Img API to enhance and edit their photos. The API excels at removing unwanted elements, improving color schemes, and enhancing overall image quality. With its image refinement capabilities, professionals can fine-tune their photographs to achieve the desired visual effects, making it an essential tool for high-quality image editing.

Custom Visual Effects and Animation

The Stable Diffusion Img2Img API is also highly beneficial for creating custom visual effects and animations. Animators and VFX artists can use the API to transform base images into dynamic visuals that align with a specific artistic direction. The ability to control the visual transformation through text prompts provides more creative control, making the API a valuable asset for producing unique animations or adding sophisticated effects to films, games, or multimedia projects.

Top Trending Generative AI APIs

 

Maximize the potential of your projects with our Generative AI APIs. From video generation & image creation to text generation, animation, 3D modeling, prompt generation, image restoration, and code generation, our advanced APIs cover all aspects of generative AI to meet your needs.