How to convert png image to webp using n8n?

Describe the problem/error/question

I’m trying to generate an image using the ChatGPT Image Generation node, then convert it from PNG → WebP in n8n, and finally upload it to WordPress via REST API.

The PNG is generated successfully, but when I try to convert it to WebP using either the Image node or a Function node with sharp, the result doesn’t seem to work correctly for upload — it either uploads as a broken image or fails to convert at all.

I’d like to know:

  • What is the correct way to convert an image generated by the OpenAI Image node (PNG) into WebP format inside n8n Cloud?

  • Is there a known limitation with the Image node when handling this?

Please share your workflow

Hi there, i would suggest you to use a 3rd party API within n8n cloud for this, such an convertAPI or cloudconvert

for cloud convert you can see the documentation here on how to implement it, and i believe they have some free quota for you to try it out if im not mistaken

You can create webp-images directly with gpt-image-1. In order to use the OpenAI API with a request body optimized for your needs, you may replace the ChatGPT Image Generation node with a HTTP request node (method POST, url: https://api.openai.com/v1/images/generations)

https://platform.openai.com/docs/api-reference/images/create

there is a node for that

1 Like

Hey @vimaGithub hope all is good. Welcome to the community.

To summarize, the workflow you were originally talking about would looks something like this: