Automated Midjourney images using API!

Neil Stephenson | No-Code AI & Automation
20 Aug 202414:13

TLDRIn this tutorial, Neil explains how to automate MidJourney image generation using an API with services like Make.com, Airtable, and User API. He walks through the step-by-step process of setting up automated scenarios that allow for generating and upscaling images without manual intervention. Neil showcases how to dynamically generate prompts, send them to MidJourney, receive the results, and automate the upscaling process. The tutorial is ideal for users looking to streamline image creation for tasks like blog posts, ads, or social media, eliminating the need to manually interact with Discord.

Takeaways

  • 🤖 Learn how to automate image generation using the Midjourney API and avoid manual steps.
  • 🔧 The tutorial uses Make.com, Airtable, and the User API to automate image creation processes.
  • 💡 OpenAI's image generation quality is lower than MidJourney, so this setup focuses on MidJourney’s API.
  • 🎯 Ideal for automating tasks such as generating images for blog posts, ads, or social media content.
  • 💻 Step-by-step guide provided to set up the API and automate image generation without manual interaction on Discord.
  • 🔗 The integration uses Make.com's modules to simplify the process, avoiding direct HTTP requests.
  • 🌐 The automation includes using a web hook URL to send results back after generating the images.
  • 🔄 The automation process handles four images and upscales them sequentially to complete the task.
  • 🖼️ Images are dynamically uploaded into Airtable, which stores the image IDs and URLs for further use.
  • 🚀 Future videos may expand on this concept, incorporating it into larger automation workflows such as blog post creation or Facebook ads.

Q & A

  • What is the main goal of the video?

    -The main goal of the video is to teach viewers how to automate MidJourney image generation using an API and integrate it into different automation scenarios.

  • What services and tools are used in the automation process?

    -The automation process uses make.com, Airtable, and User API for the MidJourney image generation.

  • Why is MidJourney preferred over OpenAI's API for image generation?

    -MidJourney is preferred because its image quality is superior to OpenAI's API for generating high-quality visuals for various purposes like social media posts and blog articles.

  • How does the automation process handle image generation in the provided scenario?

    -The process generates a prompt for MidJourney, sends the prompt using the User API, receives the result through a webhook, and then upscales the generated images.

  • What is the purpose of the webhook URL in the automation?

    -The webhook URL is used to receive the result once the image generation is complete, ensuring the automation can proceed with upscaling and further processing.

  • How does the automation handle upscaling multiple images from MidJourney?

    -A repeater module is used in the automation to iterate four times, upscaling each of the four generated images individually.

  • What issue was encountered during the process and how was it resolved?

    -The issue was a hash error that prevented upscaling, which was resolved by correcting the module settings and addressing rate limiting caused by too many requests to MidJourney.

  • How does the automation ensure the correct image data is inserted into Airtable?

    -The automation dynamically inserts the image ID and file URL into Airtable, creating a record with the upscaled image.

  • What are some potential use cases for this MidJourney automation?

    -The automation can be used for dynamically generating images for blog posts, Facebook ads, and other content that requires visual elements.

  • What additional functionality does the video suggest could be added in future tutorials?

    -The video suggests that future tutorials might cover more comprehensive automations, such as generating entire blog posts or social media ads, incorporating MidJourney image generation.

Outlines

00:00

📷 Automating MidJourney Image Generation with API

In this section, Neil introduces the concept of using a third-party API to automate image generation with MidJourney, without manually interacting with Discord. He explains how this approach is useful for automating tasks like creating blog posts, social media ads, or other content that requires images. Neil contrasts the quality of OpenAI’s API with MidJourney, pointing out that the latter produces better results. The key tools for this automation are Make.com, Airtable, and User API. Neil will demonstrate how to use them step-by-step for programmatic image generation.

05:01

💻 Setting Up Scenario 1: Image Prompt Creation

Neil dives into the setup for the first automation scenario, explaining how to create an image prompt using the User API. He outlines how to pass a manually created prompt (which could be dynamically generated in a real workflow) and use it to generate images via the API. He discusses how to set up a webhook URL that receives the generated image from User API and the importance of connecting the API key from User API for this process to work seamlessly.

10:04

🖼️ Setting Up Scenario 2: Webhook Response Handling

In this section, Neil explains the setup for the second scenario, which handles the webhook response from the first step. He shows how to create a webhook in Make.com that will receive the image data generated by User API. This involves copying and pasting the webhook URL into the correct place and ensuring that it can handle the incoming data properly. Neil also prepares for the next stage by setting up placeholders to dynamically capture relevant information from the response, such as the image hash.

📈 Scenario 3: Upscaling and Finalizing Images

Neil describes the third scenario where the image from the second webhook is upscaled using the User API’s upscaling module. He explains how to set up this automation to upscale each of the four images generated by MidJourney. He adds a repeater module to run the upscaling process four times, once for each image, and dynamically inserts the correct image position in each iteration. After some troubleshooting with his User API account, he hardcodes certain values to finalize the setup and ensure everything works smoothly.

🏁 Running the Complete Workflow

Neil explains how to run the full automation workflow from start to finish. He demonstrates how the automation generates the image, sends the response to the second webhook, and then upscales the images before uploading them to Airtable. The final images are stored in an Airtable table, ready to be used. He also highlights how this process can be dynamically customized, for example by feeding a prompt from an article or blog post. Neil concludes by suggesting the possibility of expanding the automation in future videos, such as building workflows for Facebook ads or complete blog posts.

Mindmap

Keywords

API

An API (Application Programming Interface) is a set of rules that allows one software program to interact with another. In the video, the API allows users to connect to MidJourney to generate images programmatically without manual input, streamlining processes like creating blog posts or social media content.

MidJourney

MidJourney is a popular AI-powered image generation tool that creates high-quality, creative visuals based on text prompts. The video discusses how to automate image generation using a third-party service instead of manually inputting prompts in Discord, highlighting MidJourney's superior image quality over other tools like OpenAI's image generator.

Automation

Automation refers to using technology to perform tasks without human intervention. In the context of the video, automation helps streamline image generation, such as for blog posts or social media campaigns, removing the need for manual interaction with MidJourney by integrating it into a workflow using tools like Make.com.

Make.com

Make.com is an automation tool that connects apps and services to automate tasks. In the video, it’s used to create scenarios that automate the process of sending prompts to MidJourney, receiving generated images, and processing them further without manual intervention, making it a key component in the automated workflow.

User API

The User API in this context is a third-party service that provides an API module to interact with MidJourney. The video shows how to use this service to handle the generation and retrieval of images automatically, eliminating the need for direct HTTP requests by offering built-in modules.

Scenario

In automation workflows, a scenario refers to a sequence of actions designed to achieve a specific outcome. The video explains how three distinct scenarios are created in Make.com to handle the image generation, response collection, and upscaling processes when working with MidJourney and User API.

Webhook

A webhook is a way for one system to send real-time data to another whenever a specific event occurs. In the video, webhooks are used to send and receive data between the User API and Make.com, ensuring that image generation and upscaling results are processed automatically as soon as they're available.

Prompt

A prompt is a text description provided to an AI tool like MidJourney to generate an image based on the description. The video shows how prompts can be hardcoded or dynamically generated from content (like articles) before being sent to MidJourney through the automated workflow, creating relevant images for various applications.

Upscaling

Upscaling refers to increasing the resolution or quality of an image. In the video, the automation process includes upscaling the images generated by MidJourney, where each of the four variations is individually enhanced before final processing, improving the quality of the visual output.

Airtable

Airtable is a database management tool that allows users to organize and store information in a flexible spreadsheet format. The video shows how Airtable is used to store the generated images from MidJourney, allowing the automation system to organize images, IDs, and other metadata for further use.

Highlights

Introduction to using a third-party service to generate MidJourney images programmatically using an API.

Explanation of situations where automation is useful, such as generating images for blog posts, social media, or ads.

Comparison between using OpenAI's API and MidJourney, emphasizing the superior image quality of MidJourney.

Overview of how to avoid manual steps in MidJourney, like using Discord to generate and download images.

Introduction to make.com and Airtable as part of the automation setup, along with user API integration.

Instructions on creating the first automation scenario to generate an image from a prompt and send it to a webhook URL.

Details on using dynamic prompts from previous automation steps, such as generating a prompt using GPT-4.

Explanation of the need for a webhook to receive the image generation results and the creation of the second scenario.

Step-by-step guide on adding a user API module to upscale generated images.

Explanation of using a repeater module to upscale each of the four MidJourney images generated in one run.

Resolution of an issue with incorrect hashes and rate limiting during requests to the MidJourney server.

Creation of a table in Airtable to store the generated images and their corresponding hashes.

Final steps to link all three scenarios and dynamically upscale the images before uploading them to Airtable.

Example of running the automation to generate four images of 'two mice having a heated debate' and uploading them to Airtable.

Conclusion with suggestions for expanding the automation to create blog posts or Facebook ads, using dynamically generated MidJourney images.