n8n

How to Generate OpenAI and ImgBB Image URLs?

Turn images into fast links ready for the web. Great for marketing teams, bloggers, and site owners who need hosted images that load quickly and look good on any page.

The flow can create an image from a short prompt using OpenAI, then uploads that file to ImgBB to get a link. Next it sends the hosted image to ReSmush.it to reduce file size. The optimized version is then saved back to ImgBB so you get a final, stable URL to use anywhere. You can also skip the AI step and feed in your own image file. The end result is a clean public link with a smaller file size.

You will need an ImgBB API key and optional OpenAI credentials. ReSmush.it does not need an account. Expect faster publishing and smaller image sizes, which helps page speed and SEO. Use it for product shots, blog graphics, ad creatives, and social images where a quick, reliable URL is needed.

What are the key features?

  • Create images from a plain text prompt using OpenAI
  • Upload images to ImgBB with multipart form data to get a link
  • Optimize images through ReSmush.it using the hosted URL
  • Store the optimized version back on ImgBB for a stable public link
  • Optional Set node to define or change the image description before generation
  • Consistent output structure so downstream tools can read the final URL

What are the benefits?

  • Reduce manual upload and optimization from 20 minutes to 2 minutes per image
  • Cut image file sizes by up to 60 percent using automatic compression
  • Publish a single public URL you can paste into websites, emails, and apps
  • Use one pipeline for both AI generated and local images
  • Speed up page loads to improve SEO and user experience

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with OpenAI, ImgBB and ReSmush.it. See the Tools Required section above for links to create accounts with these services.
  3. Open the Generate Image node and create an OpenAI credential. Paste your OpenAI API key from your OpenAI account page, name the credential, and save it.
  4. In the Set image description node, enter a short prompt or map a field that holds the image idea. Keep the text simple and clear.
  5. Open the Upload Img to ImgBB for URL node. Under authentication choose Query Auth. Create a new HTTP Query Auth credential with name set to key and value set to your ImgBB API key. Save the credential.
  6. Confirm the Upload Img to ImgBB for URL node sends multipart form data with the field image mapped to the binary property named data. If you are not using OpenAI, connect your own image input so the binary data field is available as data.
  7. Open the ReSmush.it Image Optimisation node and verify the URL uses the expression that points to {{$json.data.url}} from the first ImgBB upload. No authentication is required.
  8. Open the Store Optimised Image ImgBB node and select the same ImgBB Query Auth credential. Confirm the body field image is set to {{$json.dest}} from ReSmush.it and headers use application/x-www-form-urlencoded.
  9. Run the workflow and watch each node. Check that the first ImgBB step returns data.url, ReSmush.it returns dest, and the final ImgBB step returns a new data.url for the optimized file.
  10. If the ImgBB steps fail with 400 or 403, verify the API key and that the parameter name is key. If ReSmush.it errors, ensure the image URL is publicly reachable. If OpenAI fails, check your API quota and model permissions.
  11. Optional: Skip the OpenAI node and feed your own image file. Make sure the binary property name is data so the upload node picks it up.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

ImgBB

Sign up

3-Year Pro: $3.99 / mo (billed $143.64 every 3 years). Includes API access.

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

ReSmush.it

Sign up

API free: $0 (as of Mar 2024), personal use only; commercial/business pricing not published—contact ReSmush.it. Max 5 MB per image.

Credits:
Made by Simon at automake.io

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.