Skip to content

SingleApi

Internet, programming, artificial intelligence

Menu
  • Home
  • About
  • My Account
  • Registration
Menu

n8n DrawThings

Posted on July 15, 2025

For my workflow I have integrated DrawThings, the diagram of it looks like:

Steps to reproduce:

  • Assuming n8n is in Docker and DrawThings are on the host URL, it should be http://host.docker.internal:7860/sdapi/v1/txt2img. We need to use JSON, not fields, because n8n converts them to strings, and n8n has problems with interpretation. In my case, it’s:
    {
        "height": 576,
        "width": 1024,
        "seed": -1,
        "prompt": "{{ $json.output.replaceAll('"', '\'').replaceAll('\n', '') }}",
        "batch_size": 1
    }
    • Next, we need to move the Base64 string to the file using the field images[0] and put it in the data field.
    • We save PNG as e.g. /tmp/{{ $now.format('yyyy-MM-dd_HH-mm-ss') }}.png
    • For conversion to WebP, we use a simple script and the SharpJS library executed as: npm run convert -- {{ $json.fileName }}
    // convert.js
    const fs = require('fs');
    const sharp = require('sharp');
    
    async function convertPngToJpeg(filePath) {
        const outputPath = filePath.replace(/\.png$/i, '.webp');
        const input = fs.readFileSync(filePath);
    
        const output = await sharp(input).webp().toBuffer();
    
        fs.writeFileSync(outputPath, output);
        console.log(`Converted: ${outputPath} end.`);
    }
    
    const inputPath = process.argv[2];
    if (!inputPath) {
        console.error('Usage: node convert.js <path-to-png>');
        process.exit(1);
    }
    
    convertPngToJpeg(inputPath);
    • The next thing is to get the filename from stdout.: {{ $json.stdout.match(/Converted: (.*) end./)[1] }} and pass it as filename
    • The last link is to read WebP, for example, sending it to WordPress (using the filename from the previous step).

    Hope it helps or inspires someone to use different tools 🙂

    Leave a Reply Cancel reply

    You must be logged in to post a comment.

    Recent Posts

    • AI Agent Frameworks and Development Updates
    • n8n DrawThings
    • AI Landscape: Rapid Innovation and Consolidation in Mid-2025
    • AI Model Breakthroughs and Advancements
    • AI Landscape Advances: Compute Power, Model Releases, and Integration

    Recent Comments

    • adrian on Kokoro TTS Model, LLM Apps Curated List
    • adrian on Repo Prompt and Ollama
    • adrian on A Content Creation Assistant

    Archives

    • July 2025
    • June 2025
    • May 2025
    • April 2025
    • March 2025
    • February 2025
    • January 2025
    • December 2024
    • November 2024
    • October 2024
    • September 2024
    • August 2024
    • July 2024
    • November 2023
    • May 2022
    • March 2022
    • January 2022
    • August 2021
    • November 2020
    • September 2020
    • April 2020
    • February 2020
    • January 2020
    • November 2019
    • May 2019
    • February 2019

    Categories

    • AI
    • Apple Intelligence
    • Claude
    • Cursor
    • DeepSeek
    • Gemini
    • Google
    • Graphics
    • IntelliJ
    • Java
    • LLM
    • Made in Poland
    • MCP
    • Meta
    • Open Source
    • OpenAI
    • Programming
    • Python
    • Repo Prompt
    • Technology
    • Uncategorized
    • Vibe coding
    • Work

    agents ai apple apps automation blender cheatsheet china claude codegen comfyui deepseek docker draw things flux gemini google hidream hobby hugging face huggingface java langchain langchain4j llama llm mcp meta mlx movies n8n news nvidia ollama openai personal thoughts rag release repo prompt speech-to-speech spring stable diffusion tts vibe coding work

    Meta

    • Register
    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org

    Terms & Policies

    • Privacy Policy
    ©2025 SingleApi | Design: Newspaperly WordPress Theme
    We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
    Do not sell my personal information.
    Cookie settingsACCEPT
    Privacy & Cookies Policy

    Privacy Overview

    This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
    Necessary
    Always Enabled
    Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
    Non-necessary
    Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
    SAVE & ACCEPT