Automated Midjourney images using API!

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

TLDRIn this tutorial, Neil demonstrates how to automate the generation of mid-journey images using a third-party API service. He explains the process of setting up an automation with Make.com, Airtable, and the User API to programmatically create images for blog posts, social media, or ads. The tutorial covers creating prompts, generating images, and upscaling them without manual intervention, showcasing a practical application of API integration for content creation.

Takeaways

  • 😀 Neil is teaching how to generate mid-journey images programmatically using an API.
  • 🔧 The process is useful for automation tasks like creating blog posts or social media content with images.
  • 📈 OpenAI's API is mentioned as an alternative but is considered inferior in quality to Midjourney.
  • 💻 The tutorial covers building the automation from scratch using Make.com, Airtable, and User API.
  • 🔑 A User API account and API key are required, with a free tier available for basic use.
  • 📝 The automation involves three scenarios: image generation, webhook response, and image upscaling.
  • 🔗 Webhook URLs are crucial for receiving the generated images and sending them to the next step.
  • 🖼️ The image generation uses a hardcoded prompt, but it can be dynamically generated from previous automation steps.
  • 🔄 An upscaling process is included to enhance the quality of the generated images.
  • 🔁 A repeater module is used to upscale each of the four images generated by Midjourney.
  • 📊 The final images are uploaded to an Airtable base with records for each image ID and attachment.
  • 📈 The tutorial provides a foundation that can be expanded into more complex automations for creating content like blog posts or ads.

Q & A

  • What is the main topic of the video?

    -The main topic of the video is teaching viewers how to use a third-party service to generate mid-journey images programmatically using an API.

  • Why is Midjourney preferred over OpenAI for image generation?

    -Midjourney is preferred over OpenAI for image generation because the quality of images produced by Midjourney is considered superior.

  • What is the alternative method mentioned for generating Midjourney images?

    -The alternative method mentioned is to generate a prompt, use it in Discord to run the prompt, download the images, and then upload them to a website or social media account.

  • What are the three scenarios required for the automation?

    -The three scenarios required for the automation are: 1) Generating the image using a prompt, 2) Receiving the webhook response, and 3) Upscaling the images.

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

    -The webhook URL is used to send the result of the image generation to a specified endpoint once the process is completed.

  • How does the user API module simplify the automation process?

    -The user API module simplifies the automation process by eliminating the need to use HTTP modules for manual API requests, thanks to its Make module.

  • What is the significance of the 'upscale' step in the automation?

    -The 'upscale' step is significant because it enhances the quality of the generated images, making them more suitable for use in publications or advertisements.

  • Why is a repeater module used in the third scenario?

    -A repeater module is used in the third scenario to upscale each of the four images generated by Midjourney individually.

  • What does the user API step two response scenario do?

    -The user API step two response scenario receives the upscaled image data from the webhook and processes it for further use in the automation.

  • How are the upscaled images stored after the automation is complete?

    -The upscaled images are stored in an Airtable base, with records containing an image ID and an image attachment field.

  • What is a potential use case for the automation process demonstrated in the video?

    -A potential use case for the automation process is generating images for blog posts, Facebook ads, or social media posts, where an image is needed to accompany the content.

Outlines

00:00

🖼️ Automating Mid-Journey Image Generation

Neil introduces a tutorial on using a third-party service to generate Mid-Journey images programmatically via an API. This is useful for automation scenarios such as creating blog posts, Facebook ads, or social media posts that require images. He compares using OpenAI's API to Mid-Journey for image quality and suggests an alternative method that automates the process of generating prompts, getting images from Discord, and uploading them without manual intervention. The tutorial will build the automation from scratch using Make.com, Airtable, and the User API, with a focus on setting up User API and creating scenarios for image generation and webhook responses.

05:01

🔗 Setting Up Webhook and API Modules

The second paragraph details the process of setting up a webhook and API modules for the automation. Neil explains creating scenarios in Make.com, connecting them to User API, and using webhooks to receive image generation results. He demonstrates how to input a hardcoded prompt for image generation and discusses the dynamic insertion of prompts from previous automation steps. The focus is on setting up the first two scenarios, including saving webhook URLs and preparing for image upscaling in the third scenario.

10:04

🖼️ Upscaling and Storing Images

In the final paragraph, Neil discusses the process of upscaling images and storing them in Airtable. He explains adding a User API module to upscale the images received from the webhook and setting up a repeater to upscale each of the four generated images individually. The paragraph covers troubleshooting issues with the User API account and rate limits due to multiple requests. Neil then demonstrates how to use the upscaled images to create records in Airtable, including image IDs and file URLs, and concludes with a live demonstration of the automation process generating four images of a scenario described by a dynamic prompt.

Mindmap

Keywords

💡API

An API, or Application Programming Interface, is a set of rules and protocols for building and interacting with software applications. In the context of the video, the presenter is teaching how to use an API to automate the generation of images using a third-party service called Midjourney. The API allows for programmatic requests to be sent to Midjourney without manual intervention, which is crucial for automating tasks like creating blog posts or social media content that require images.

💡Midjourney

Midjourney is a service that generates images based on textual prompts. It is mentioned as a superior alternative to OpenAI for image generation due to its higher quality output. The video's tutorial focuses on how to integrate Midjourney's capabilities into an automated workflow via its API.

💡Automation

Automation refers to the process of making an action, process, or mechanism run automatically. In the video, Neil is demonstrating how to automate the creation and use of images for various digital content, such as blog posts or social media updates, by using APIs and webhooks. This eliminates the need for manual image generation and uploading, streamlining the content creation process.

💡Webhook

A webhook is a user-defined HTTP callback, triggered by an event in a web application. In the script, webhooks are used to receive responses from the Midjourney API after an image generation request is made. The webhook URL is where the API sends the result once the image is generated, which is then used to trigger further actions in the automation sequence.

💡User API

User API, as mentioned in the video, is a third-party service that acts as an intermediary between the user and the Midjourney API. It simplifies the process of sending API requests and handling responses, which is beneficial for users who are not familiar with HTTP modules or manual API request handling. The video uses User API to facilitate the automation of image generation from Midjourney.

💡Make.com

Make.com is a platform for building automation workflows. In the video, it is used to create the automation scenarios necessary for generating images from Midjourney. The platform allows for the creation of sequences that can trigger API requests, handle webhooks, and perform other actions needed to automate the process discussed.

💡Airtable

Airtable is a cloud-based platform that combines the flexibility of a spreadsheet with the power of a database. In the video, Airtable is used to store and organize the generated images, along with their associated data, such as image IDs and file URLs. This allows for easy management and retrieval of the images for future use in various content pieces.

💡Prompt

In the context of the video, a 'prompt' is a textual description or command that is sent to the Midjourney service to generate an image. The prompt acts as instructions for the image generation AI, telling it what kind of image to create. For example, the script mentions a hardcoded prompt 'two mice having a heated debate', which would result in images that depict this scenario.

💡Upscale

Upscaling in the video refers to the process of enhancing the quality or resolution of an image. After the initial images are generated by Midjourney, the automation includes a step to upscale these images for better quality, which is important for use in high-resolution formats like print or high-definition digital media.

💡Rate Limiting

Rate limiting is a technique used to restrict the amount of API requests a user can make within a certain period. In the video, the presenter mentions encountering rate limiting from the Midjourney server due to too many requests at once. This is an important consideration in API usage, as it can affect the performance and reliability of automation workflows.

Highlights

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

Situations where automation includes images, like blog posts, ads, or social media posts.

Comparison of using OpenAI's API versus MidJourney for image quality.

Alternative method of generating prompts and using Discord for image generation.

Building automation from scratch to remove manual steps in image generation.

Using make.com, airtable.com, and user API for the automation.

Explanation of user API and its free tier with documentation.

Creating a scenario with three separate automation steps using user API.

First step involves generating an image using a hardcoded prompt.

Second step is creating a webhook for receiving the image generation result.

Third step involves upscaling the generated image.

Using a repeater to upscale each of the four images generated by MidJourney.

Incorporating an Airtable module to store the image ID and attachment.

Running the automation and waiting for the webhook to receive the image data.

Handling rate limiting issues with MidJourney server requests.

Hardcoding certain values for testing purposes.

Final step of uploading the upscaled images to Airtable.

Demonstration of the complete process resulting in four images of 'two mice having a heated debate'.

Potential for future videos on more comprehensive automation for blog posts or ads.