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', 'Ocp-Apim-Subscription-Key: 33caec0f168a4906a39ba9dfdec6d2f0',); 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
-
API Documentation for Stable Diffusion Img2img API
Overview
Stable Diffusion XL API is an advanced AI image generation technology developed by Stability AI. This state-of-the-art AI model excels in creating lifelike faces, integrating readable text into images, and enhancing overall image composition. The Stable Diffusion XL API is built on the powerful latent diffusion model, which allows it to generate high-quality images from simple text prompts. This makes it one of the most versatile and efficient image generators available today. Whether you're looking to create detailed portraits, add text to images seamlessly, or improve the overall aesthetic quality of your visuals, this API offers unparalleled capabilities.
One of the standout features of the Stable Diffusion XL API is its ability to interpret and execute text prompts with high precision, ensuring that the output image aligns closely with the user's vision. The API handles various Content-Type inputs, making it flexible and easy to integrate into different workflows. Additionally, the guidance_scale parameter is a critical tool within the API that controls the influence of the text prompt on the generated image. By adjusting the guidance_scale, developers can fine-tune the balance between creativity and adherence to the prompt, allowing for a wide range of artistic and practical applications. This flexibility makes the API suitable for a broad spectrum of use cases, from web design and advertising campaigns to digital art projects and more.
The Stable Diffusion XL 1.0, the base model of this API, ensures high-resolution image synthesis, delivering visuals that are both aesthetically pleasing and accurate representations of the input cues. The API also supports the generation of several images in a single request, streamlining the creative process and enhancing productivity. By leveraging the robust functionalities of the Stable Diffusion XL API, developers and artists can transform image manipulation, content creation, and creative expression, opening up a world of possibilities for immersive visual experiences. The comprehensive documentation provided by Stability AI ensures that users can effectively utilize the API's parameters and maximize its potential for various creative and practical endeavors.
-
API Parameters
The API POST
https://gateway.appypie.com/img2img/getImage/v1/getSDXLImage takes the following parameters:
prompt
string, required
negative_prompt
string, optional
response_format
JavaScript Object Notation (JSON)
size
string, optional, default: 1024x1024
Integration and Implementation
To utilize the Stable Diffusion img2img API, developers are required to send POST requests to the designated endpoint along with the correct headers and request body. The request body should encompass the image inputs, text prompt, and any additional parameters, such as negative prompts and image size.
Base URL
https://gateway.appypie.com/img2img/getImage/v1/getSDXLImage
Endpoints
POST /getImage
This endpoint generates images based on the provided image input and text prompts.
Request
- URL: https://gateway.appypie.com/img2img/getImage/v1/getSDXLImage
- Method: POST
- Headers:
- Content-Type: application/json
- Cache-Control: no-cache
- Ocp-Apim-Subscription-Key: {subscription_key}
- Body:
JSON
{ "prompt": "Change to a cat" }
- HTTP Status Codes:
- 200 OK: The request was successful, and the generated image is included in the response body.
- 400 Bad Request: The request needed to be corrected or include some arguments.
- 401 Unauthorized: The API key provided in the header is invalid.
- 500 Internal Server Error: An error occurred on the server while processing the request.
- Sample Response:
JSON
{ "status": 200, "content-type": "image/png", "content-length": "size_in_bytes", "image_data": "base64_encoded_image_data" }
- Error Field Contract:
- code: An integer that indicates the HTTP status code (e.g., 400, 401, 500).
- message: A clear and concise description of what the error is about.
- traceId A unique identifier that can be used to trace the request in case of issues.
- Graphic Design and Artistic Applications: The Stable Diffusion Img2img API is a powerful tool for graphic design and artistic purposes. Designers can utilize this advanced image-to-image model to refine images quickly and efficiently for various creative projects. Whether working on digital art, promotional materials, or branding assets, the API ensures that image quality remains consistently high. By integrating the refinement model capabilities, designers can enhance details, adjust colors, and apply specific artistic styles, making it an indispensable resource for creative professionals.
- Image Generation: Ideal for content generation, the Stable Diffusion Img2img API helps produce high-quality images for social media, advertising, and marketing purposes. By providing refined images based on specific prompts and styles, this API streamlines the creation process and allows for rapid text-to-image generation. Marketers and content creators can generate many images tailored to their campaigns, ensuring visually engaging content that resonates with their audience. The API's ability to handle various API calls efficiently makes it a valuable asset in maintaining a dynamic and visually appealing online presence.
- Research and Development: Researchers in the fields of image processing, computer vision, and machine learning can leverage the Stable Diffusion Img2img API for high-quality image creation. The API aids in testing and validation by generating precise and reliable images, essential for experimental accuracy. By employing the Stable Diffusion 1.5 model, researchers can ensure that their datasets are enhanced with clear and detailed visuals, facilitating better outcomes in their studies.
- Education and Training: In educational settings, the Stable Diffusion Img2img API can be a practical tool for teaching students about image processing, computer vision, and machine learning. Through interactive learning experiences, students can engage with the API to understand the intricacies of image refinement. The refiner model helps in demonstrating real-world applications, allowing students to experiment with image enhancement techniques and gain hands-on experience.
- Image Editing and Enhancement: Photographers and image editors can greatly benefit from the Stable Diffusion Img2img API to enhance and edit images. The API excels in removing unwanted elements, improving colors, and boosting overall image quality. By using the refinement model, professionals can fine-tune their photographs to achieve the desired visual effect, ensuring that each image meets the highest standards of quality.
- Custom Image Generation: Users can harness the power of the Stable Diffusion Img2img API to generate images from scratch by providing detailed text prompts. This unique capability of our AI image generation model allows for the creation of custom visuals based on specific descriptions, offering a novel approach to text-to-image generation. Whether for personal projects, creative endeavors, or professional use, the API provides a flexible and innovative solution for generating bespoke images.
- Image Recognition: The Stable Diffusion Img2img API can be instrumental in developing image recognition applications. By identifying objects, people, and scenes in images, the API can be applied in various industries such as healthcare, retail, and security. Its robust image-generation capabilities support the development of accurate and efficient recognition systems, enhancing the effectiveness of these applications.
- High-Quality Image Generation: The Stable Diffusion img2img API excels in producing high-quality images. Utilizing state-of-the-art algorithms, it ensures that the image output maintains exceptional clarity, detail, and color accuracy. This is particularly beneficial for applications requiring professional-grade visuals, such as graphic design, marketing, and digital art.
- Versatile Input Handling: The API supports a wide range of input types, allowing users to transform existing images into new styles or refine them according to specific criteria. Whether you need to enhance a photograph, apply a new artistic style, or generate variations from a base image, the API provides the necessary tools to achieve your goals.
- Text-to-Image Generation: One of the standout features is its text-to-image generation capability. By inputting text prompts, users can generate images that match the described content. This feature is highly valuable for creating custom visuals based on specific descriptions, and streamlining the creative process for content creators, marketers, and designers.
- Refinement Model: The API includes an advanced refinement model that allows for precise image enhancement. This model can improve image details, adjust color balance, and remove unwanted elements, ensuring that the final output meets the highest standards of quality. It is ideal for applications in photography, graphic design, and digital publishing.
- Handling Multiple Images: Stable Diffusion Img2img API can generate a significant number of images in a single request, making it efficient for bulk processing. This feature is particularly useful for eCommerce platforms, advertising campaigns, and social media content creation, where multiple high-quality images are needed quickly and consistently.
- Customization with Parameters: Developers can customize the output by using various parameters, such as negative prompts and image size adjustments. These parameters allow for fine-tuning the generated images to match specific requirements, providing greater control over the final results. Additionally, the Stable Diffusion Img2img API supports various aspect ratios, ensuring the generated images fit different display requirements.
- Integration and API Calls: Designed for seamless integration, the Stable Diffusion img2img API handles multiple API calls efficiently. This ensures that developers can incorporate the API into their existing workflows with minimal disruption, allowing for scalable and reliable image generation across various applications.
- Image Recognition and Processing: Beyond image generation, the Stable Diffusion Img2img API can be utilized for image recognition tasks. It can identify objects, people, and scenes within images, making it suitable for applications in healthcare, retail, security, and more. This feature enhances the utility of the API in complex image processing and analysis tasks.
- Support for High Resolution: Stable Diffusion Img2img API is capable of generating high-resolution images, ensuring that the output is suitable for professional use. Whether for print media, large-scale digital displays, or detailed artwork, the high-resolution capability ensures that the images are sharp and visually appealing.
- Film Grain Effect: For a more authentic and vintage look, the Stable Diffusion img2img API includes a film grain effect. This feature allows users to add a classic film grain texture to their images, enhancing the aesthetic quality and providing a nostalgic feel.
- Text Encoders and Legible Text: The API uses advanced text-encoders to ensure that any text embedded within images remains legible text. This is particularly useful for creating informative graphics, social media posts, and marketing materials where clear and readable text is essential.
- Image-to-Image Prompting: The Stable Diffusion img2img API supports image-to-image prompting, allowing users to input an existing image and generate new variations based on it. This feature is perfect for iterative design processes, enabling creators to refine and enhance their visuals progressively.
- Generation Process: The generation process of the Stable Diffusion img2img API is designed for efficiency and quality. By leveraging advanced models like Stable Diffusion 2.1 and Stable Diffusion SDXL 1.0, the API ensures that each image is generated with precision and meets high standards of visual fidelity.
- Foundation Models: The API uses advanced foundation models like Stable Diffusion 2.1 and Stable Diffusion SDXL 1.0 to ensure high-quality image synthesis. These models are at the forefront of AI technology, designed to interpret and generate images with remarkable accuracy and detail. The integration of these models allows for a wide range of creative possibilities, from highly realistic images to more abstract, artistic interpretations. This versatility makes the API suitable for various industries, including entertainment, marketing, and digital art.
- Attention Blocks: The API incorporates sophisticated attention blocks to enhance image detail and quality by focusing on relevant parts of the image during generation. Attention blocks are crucial for capturing intricate details and maintaining the coherence of the generated images. They allow the model to prioritize different regions of an image based on the context provided by the input prompt, ensuring that essential features are highlighted and rendered accurately. This results in more visually appealing and contextually appropriate images, making the API a powerful tool for tasks requiring high precision and detail.
- Noisy Latents: Utilizes noisy latents to introduce controlled randomness in the image generation process, enhancing creativity and diversity in outputs. Noisy latents add a layer of variability that can lead to unique and innovative results, particularly useful in creative industries where original content is highly valued. By introducing noise at specific stages, the API can generate a wide range of image variations from a single prompt, each with subtle differences. This feature is particularly beneficial for artists and designers looking to explore multiple concepts or create diverse sets of images quickly.
- Image URLs: Supports input through Image URLs, allowing easy access and manipulation of images from various sources. This capability enables seamless integration with online image repositories, making it easy to fetch and process images directly from the web. Users can provide URLs pointing to existing images, which the API will then use as a base for further transformations or enhancements. This feature is particularly useful for applications involving large datasets or for automating image processing tasks in web-based environments.
- Concept Art: Ideal for generating concept art with diverse styles and themes, suitable for creative industries. The API can quickly produce a variety of concept art pieces, helping artists and designers visualize ideas and iterate on designs. This capability is particularly valuable in industries like gaming, film, and animation, where visual concepts play a crucial role in pre-production stages. By automating parts of the creative process, the API allows artists to focus more on refining and perfecting their ideas.
- Cinematic Film: Capable of producing images with a cinematic film quality, including effects like shallow depth of field and sharp focus. This feature enhances the visual appeal of generated images, making them suitable for high-end visual media projects. By applying cinematic techniques, the API can create images that evoke a specific mood or atmosphere, adding a professional touch to the output. This is particularly useful for marketing materials, storyboarding, and any project where high visual impact is desired.
- Prompt Strength: The prompt_strength parameter allows fine-tuning of how strongly the text prompt influences the generated image, providing a balance between adherence to the prompt and creative flexibility. This parameter gives users control over the degree to which the generated image reflects the input text, allowing for a range of outcomes from highly literal to more interpretive. This flexibility is important for various creative processes, enabling users to experiment with different levels of influence and find the right balance for their specific needs.
- Shallow Depth of Field: Enhances images with a shallow depth of field effect, creating a professional and polished look. This feature mimics the effect of a camera lens focusing on a specific subject while blurring the background, adding depth and dimension to the image. It is particularly useful for portrait photography, product images, and any scenario where emphasizing a particular element is desired. By simulating this effect, the API can produce images that appear more lifelike and visually engaging.
- Sharp Focus: Ensures critical elements of the image are in sharp focus, enhancing visual appeal and clarity. Sharp focus is essential for maintaining the quality and readability of key details within an image. This feature is especially important for applications involving detailed graphics, technical illustrations, and any context where clarity is paramount. By prioritizing sharpness, the API ensures that the final output is both aesthetically pleasing and functionally effective.
- Import Requests: Easy integration with Python using import requests for making API calls. This simplicity in integration allows developers to quickly set up and start using the API in their Python-based projects. The ability to use standard libraries like requests makes it straightforward to send requests, handle responses, and manage data. This ease of use encourages broader adoption and enables developers to incorporate advanced image generation capabilities into their applications with minimal effort.
- API Calls: Handles multiple API calls efficiently, supporting batch processing and high-volume requests. This capability is important for applications that require the generation of many images at once, such as eCommerce platforms, marketing campaigns, and social media content planning. By managing multiple requests effectively, the API can scale to meet the demands of large projects, ensuring that all images are processed quickly and accurately. This scalability makes the API a robust solution for enterprises and large-scale applications.
- AI Model: Refers to the underlying machine learning model used to interpret the text prompts and generate corresponding images.
- Changelog: Document detailing any updates, bug fixes, or improvements made to the API in each version.
- Enhanced User Engagement: The API empowers users to create visually captivating images, thereby elevating user engagement levels across diverse platforms and applications. By leveraging the API's capabilities, developers can craft compelling visuals that resonate with their target audience, fostering deeper connections and interactions.
- Efficient Lead Generation: Through the generation of visually appealing content, the API facilitates efficient lead generation efforts. Engaging images can drive higher conversion rates, prompting users to take action and providing opportunities to capture valuable email addresses and contact details.
- Improved Documentation Experience: The API's comprehensive API Docs offer detailed guidelines and examples, catering to developers of all skill levels. These comprehensive resources include step-by-step instructions, parameter descriptions, and sample code snippets, ensuring accessibility and clarity in implementing the API. A robust documentation experience empowers users to troubleshoot issues effectively and optimize their usage for optimal outcomes.
- Advanced Text Embeddings: With support for text embeddings, the API can intelligently interpret textual inputs and seamlessly integrate them into generated images. This capability adds depth and context to visual content, enhancing its relevance and impact. Developers can leverage text embeddings to convey specific messages or concepts through imagery, enhancing communication and storytelling.
- Customizable Input Image: Users have the flexibility to provide input images as a base for further transformations, enabling tailored and personalized image generation processes. By incorporating existing visuals into the generation process, developers can align the generated images with specific branding guidelines or aesthetic preferences, ensuring cohesive and consistent outputs.
- Tailored Design Elements: The API offers a diverse range of design elements and customization options, empowering users to create images that resonate with their brand identity and messaging. From color palettes to graphic overlays, developers can customize every aspect of the generated images, ensuring alignment with their desired visual aesthetic and communication goals.
- Clear API Reference: The API Reference serves as a comprehensive guide to the API's functionality, providing detailed insights into available endpoints, parameters, and usage scenarios. Developers can leverage this resource to gain a deeper understanding of the API's capabilities and explore advanced features and customization options. A clear API Reference enhances developers' ability to leverage the API effectively, driving innovation and creativity in application development.
- Optimized Workflow: With clear and thorough documentation, users can efficiently implement the API in their projects, troubleshoot issues, and optimize their usage for the best results. A seamless workflow ensures that developers can focus on creativity and innovation, rather than grappling with technical complexities. By providing robust support and resources, the API facilitates a smooth documentation experience, maximizing its potential impact and value.
Responses
Error Handling
The Stable Diffusion img2img API is equipped with robust error-handling mechanisms to facilitate seamless operation. Typical status codes encountered include:
Use Cases of Stable Diffusion Img2img API
Stable Diffusion Img2img API offers a range of versatile use cases, enabling users to generate high-quality images from various inputs. Here are some key applications of the Stable Diffusion Img2img API based on the provided sources:
Advanced Features of the Stable Diffusion img2img API
The Stable Diffusion img2img API is equipped with a range of advanced features that enhance its versatility and functionality. These features make it a powerful tool for generating high-quality images from various inputs. Below are some of the key advanced features:
Technical Specifications of the Stable Diffusion img2img API
The Stable Diffusion img2img API is designed to provide advanced image generation and transformation capabilities. It leverages state-of-the-art technology to produce high-quality, versatile outputs suitable for a wide range of applications. Below are the key technical specifications and features of the API:
Definitions
What are the Benefits of Using Stable Diffusion img2img API?
Using the Stable Diffusion img2img API provides numerous advantages for developers and businesses, fostering enhanced user engagement and streamlined workflows. Here are eight key benefits, elaborated with detailed insights: