{"id":70,"date":"2025-07-20T14:21:00","date_gmt":"2025-07-20T06:21:00","guid":{"rendered":"https:\/\/blog.liu-qi.cn\/?p=70"},"modified":"2026-04-18T21:57:40","modified_gmt":"2026-04-18T13:57:40","slug":"comfyui%e5%85%a5%e9%97%a8%ef%bc%88%e4%ba%8c%ef%bc%89%ef%bc%9a%e5%a6%82%e4%bd%95%e6%89%93%e9%80%a0%e8%87%aa%e5%b7%b1%e7%9a%84%e5%b7%a5%e4%bd%9c%e6%b5%81%ef%bc%8c%e8%ae%a9ai%e7%94%9f%e5%9b%be-%e4%bf%ae","status":"publish","type":"post","link":"https:\/\/en.blog.liu-qi.cn\/2025\/07\/20\/comfyui%e5%85%a5%e9%97%a8%ef%bc%88%e4%ba%8c%ef%bc%89%ef%bc%9a%e5%a6%82%e4%bd%95%e6%89%93%e9%80%a0%e8%87%aa%e5%b7%b1%e7%9a%84%e5%b7%a5%e4%bd%9c%e6%b5%81%ef%bc%8c%e8%ae%a9ai%e7%94%9f%e5%9b%be-%e4%bf%ae\/","title":{"rendered":"ComfyUI Basics Part 2: How to Build Custom Workflows for More Efficient AI Image Generation and Editing"},"content":{"rendered":"<p>This is the second article in the ComfyUI introductory series. If you are completely new to ComfyUI, it is recommended to first read the previous article:<a href=\"https:\/\/blog.liu-qi.cn\/2025\/07\/11\/%E6%8A%8A%E5%B7%A5%E4%BD%9C%E6%B5%81%E6%8B%86%E5%BC%80%E6%8F%89%E7%A2%8E%E4%BA%86%EF%BC%8C%E5%B8%A6%E4%BD%A0%E5%85%A5%E9%97%A8comfyui\/\">Breaking Down the Workflow to Get You Started with ComfyUI<\/a>\u3002<\/p>\n<p>Originally, at the end of the last article, we were going to talk about Flux Kontext image editing.<\/p>\n<p>However, Doubao recently launched &#8216;Super Creative 2.0&#8217;. I truly feel that in most scenarios, its image editing capabilities are not inferior to Kontext, and even surpass it in creativity. If you want to use it directly and quickly handle 70% of problems, honestly, I recommend everyone try Doubao.<\/p>\n<p>Here&#8217;s a demonstration of Doubao&#8217;s effect with an image:<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/001-46197e380dc7-scaled.jpg\" \/><\/p>\n<p>Like Kontext, it performs local repainting without altering parts fixed in the prompt, but it has a lower barrier and is even free. After using it, I personally feel that the Flux Kontext model itself has become less important.<\/p>\n<p>Therefore, although this article will still cover Kontext, the focus will be on demonstrating how to comfortably use a model with specific capabilities through building a Kontext workflow. Hopefully, it will inspire your thinking on ComfyUI workflow design. I hope you approach this article with such expectations. If you need a comprehensive introduction and review of Flux Kontext&#8217;s capabilities and usage methods, you may need to read some additional articles.<\/p>\n<p>Actually, it&#8217;s not just Doubao; the Black Forest Studio also offers a Playground (https:\/\/playground.bfl.ai\/) for using Flux Kontext through conversational chat.<\/p>\n<p>At this point, I feel I must first answer a question before I can continue writing: Why use ComfyUI? Using it directly on a webpage seems fine too, so why bother learning ComfyUI?<\/p>\n<p>Behind this is actually related to another widely mentioned issue recently:<\/p>\n<p>ChatBot or Agent?<\/p>\n<p>In today&#8217;s context, it can also be written as:<\/p>\n<p>ChatBot or WorkFlow?<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/002-dd066fceefdb.png\" \/><\/p>\n<p>ChatBots have a lower usage barrier, but they can only perform single, one-off operations.<\/p>\n<p>However, in most real-world application scenarios, what we need to complete is often a set of operations. Due to interaction requirements during the process, the context window limitations of large models, etc., AI struggles to complete an entire set of operations in one go through conversational communication.<\/p>\n<p>This results in the fact that if we want to use a ChatBot to complete complex tasks, we must go through cumbersome multi-turn conversations, with both controllability and efficiency being low.<\/p>\n<p>WorkFlows solve this problem.<\/p>\n<p>They themselves represent a set of operations, and can incorporate the capabilities of large models for intelligent decision-making.<\/p>\n<p>For example,<\/p>\n<p>I often use the AI field shortcut feature in Feishu&#8217;s multi-dimensional tables, such as this table:<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/003-6131faaafe19.png\" \/><\/p>\n<p>Don&#8217;t think that only workflows connected by lines between nodes count as workflows.<\/p>\n<p>Actually, many templates built with multi-dimensional tables are essentially workflows. Even your daily routine of arriving at the office in the morning, making a cup of coffee, turning on the computer, organizing yesterday&#8217;s tasks and planning today&#8217;s work is also a workflow.<\/p>\n<p>The function implemented by the above table is to recommend travel plans in Chinese cities tailored to foreign friends with different backgrounds; any friend&#8217;s background or target city can be switched at any time.<\/p>\n<p>You can imagine how complex it would be to implement this in a ChatBot if these variable options change frequently and in large quantities.<\/p>\n<p>Let me now expand on the configuration of the last field shortcut; the prompt is written like this:<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/004-58f3d5a7b00c.png\" \/><\/p>\n<p>What do you think it resembles?<\/p>\n<p>Imagine putting it into ComfyUI: the friend&#8217;s hometown, age, gender, hobbies, etc., as information nodes. Some are initial nodes (like gender), others are secondary nodes (like what fun things there are), each pulling out a connection line to connect to the input endpoint of the final node that generates the recommendation result.<\/p>\n<p>Multi-dimensional tables and ComfyUI are just two different forms of workflow presentation.<\/p>\n<p>Now look at the next table, which is also a previously shared poster imitation template:<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/005-5b44a0c6a18f-scaled.png\" \/><\/p>\n<p>Doesn&#8217;t it look very similar to the image reverse-engineering and regeneration workflow we created in the previous ComfyUI article?<\/p>\n<p><img decoding=\"async\" alt=\"\u56fe\u7247\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/006-befb35c2c82e-scaled.png\" \/><\/p>\n<p>The underlying logic is actually the same, but in the table template&#8217;s workflow, more steps involve LLM intervention, making it more intelligent.<\/p>\n<p>This is also one of the tips I want to share to make AI image generation\/editing workflows more efficient:<\/p>\n<p>Appropriately incorporate LLMs (Large Language Models).<\/p>\n<p>Let&#8217;s use Flux Kontext as an example, since that was the original topic.<\/p>\n<p>The latest version of ComfyUI is so much more convenient than before.<\/p>\n<p>Simply click &#8216;Workflow&#8217; in the upper right corner, select &#8216;Browse Templates&#8217;, and you can import various official built-in ComfyUI workflow templates with one click.<\/p>\n<p>Here, both locally run dev version workflows and those using online APIs are provided, under the &#8216;Flux&#8217; and &#8216;Image API&#8217; tabs respectively.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/007-2f372b9bbae9.png\" \/><\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/008-3f31d519e564.png\" \/><\/p>\n<p>APIs are, after all, paid services, and the model scale is also larger. Moreover, the full fp16 local model is still a bit demanding for my 4090 with only 24GB VRAM, so I use the fp8 quantized version provided by Comfy. Therefore, in some detailed effects, the API inevitably performs better than local execution.<\/p>\n<p>However, local models have the advantage of not relying on the network and not costing money.<\/p>\n<p>In a situation where both options have their merits, my usual approach is to have them all.<\/p>\n<p>So, the first step in building my own workflow was to assemble them together, so I could use whichever one I wanted.<\/p>\n<p>Assembling workflows in ComfyUI is also very simple.<\/p>\n<p>Just hold down Ctrl, select the nodes to copy, Ctrl+C to copy, and then paste them into the target workflow window.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/009-a010728cfb84-scaled.png\" \/><\/p>\n<p>Like this, I pasted the API workflow into the local workflow window.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/010-ad05dba22695-scaled.png\" \/><\/p>\n<p>Let&#8217;s break down these two workflows one by one.<\/p>\n<p>First, the relatively complex local workflow.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/011-9e1dc40f460f.png\" \/><\/p>\n<p>Ignore the default Step 1, 2, 3 groupings; let&#8217;s look at the parts within the three colored selection boxes I&#8217;ve drawn.<\/p>\n<p>First, look at the bottom-left blue box area, which contains four nodes:<\/p>\n<p>First, two &#8216;Load Image (from Output)&#8217; nodes. Currently, one is in an ignored state, meaning only one image is loaded.<\/p>\n<p>Then, the &#8216;Image Stitch&#8217; node&#8217;s function is to combine two images together. This is because while Flux Kontext can handle multi-image references, it actually only accepts a single image input, so multiple images must be combined beforehand. I&#8217;ll demonstrate this later; if only one image is uploaded, as shown in the current state, the stitch node still outputs just one image.<\/p>\n<p>Finally, the &#8216;FluxKontextImageScale&#8217; node resizes the image. You can see the original image size is 2208<em>2944, and after processing, the preview image size becomes 880<\/em>1184, a size more suitable for local model processing.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/012-0eaac6ece778.png\" \/><\/p>\n<p>This &#8216;Load Image (from Output)&#8217; is not very convenient; it can only select previously generated images as input and needs a slight modification. Let&#8217;s replace them with two regular &#8216;Load Image&#8217; nodes, so we can upload any image.<\/p>\n<p>Right-click the second image upload node, and in the pop-up menu, click &#8216;(Un)Ignore Node&#8217; to enable it.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/013-0a5fabcb140c.png\" \/><\/p>\n<p>Let&#8217;s upload a red hat. Now, in the preview window, you can see the effect of the &#8216;Image Stitch&#8217; node; it has combined these two images into one. The &#8216;direction&#8217; parameter is &#8216;right&#8217;, so image2 (the hat) is stitched to the right side of the person.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/014-cedceced63d1.png\" \/><\/p>\n<p>Having looked at the blue box section for uploading images, now let&#8217;s examine the red and yellow boxes.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/015-e4335a6b766a-scaled.png\" \/><\/p>\n<p>The workflow encompassed by these two boxes should be very familiar to you; it&#8217;s the local Flux image generation workflow from the previous article. The only difference is that the image generation model has been changed to the Kontext model, and the positive prompt has been pulled out separately.<\/p>\n<p>Switching to the API image generation workflow, this one is even simpler.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/016-bbb816d8d997.png\" \/><\/p>\n<p>The left part uploads the original image, and the right part generates the new image.<\/p>\n<p>The Kontext API in this workflow is provided via Comfy relay, which is faster than directly connecting to the Black Forest Studio&#8217;s API. Top-ups and usage are processed through Comfy; you can find the top-up option by clicking your avatar in the upper right corner.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/017-76c8731d3c50.png\" \/><\/p>\n<p>However, Comfy&#8217;s Kontext node does not offer adjustable content moderation settings, so sometimes requests to modify abstract or NSFW images may be directly rejected.<\/p>\n<p>Therefore, another commonly used Kontext API is the official Black Forest version, which supports nodes for manually setting moderation levels. Let&#8217;s add this to the all-in-one workflow as well.<\/p>\n<p>You need to install the &#8216;Flux Kontext Creator for ComfyUI&#8217; node; the specific installation method can be found in the previous article.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/018-72029a7acbf9-scaled.png\" \/><\/p>\n<p>Then, configure the config.ini file and API key according to the instructions in the README file on GitHub. I won&#8217;t demonstrate the specific steps.<\/p>\n<p>https:\/\/github.com\/ShmuelRonen\/FluxKontextCreator<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/019-fe1857ce7b6e.png\" \/><\/p>\n<p>As for obtaining the API key and making top-ups, you need to visit the official Black Forest website mentioned earlier (https:\/\/dashboard.bfl.ai\/). By default, registration gives you 200 credits for a free trial.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/020-4c077da71863.png\" \/><\/p>\n<p>The usage of the &#8216;Flux Kontext Creator for ComfyUI&#8217; node is basically the same as Comfy&#8217;s Kontext API node, with the same connection method, but it adds parameters for manually selecting &#8216;pro&#8217; and &#8216;max&#8217; nodes and manually setting moderation intensity.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/021-62c9b0bb2f41.png\" \/><\/p>\n<p>Right-click and &#8216;Add Group&#8217; to organize nodes with the same function into a group with a colored background, as shown in the image above.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/022-dbf97fed1b4f.png\" \/><\/p>\n<p>Now, we want to put the three image generation paths\u2014local, Comfy API, and BFL API\u2014into a single workflow, where the original image loading and prompt modules can be shared among all three.<\/p>\n<p>So, we can connect the output endpoint of the uploaded image to the input image endpoints of all three; then, add an input string node and connect it to the prompt text boxes of the three, so that just by entering the prompt in the input string node, all three sub-workflows can use it.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/023-73feebd7eff6-scaled.png\" \/><\/p>\n<p>You can add an &#8216;Ignore Multiple Boxes&#8217; node in the empty space.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/024-df1699b23d70-scaled.png\" \/><\/p>\n<p>Through this node, you can quickly control the enabled state of the function boxes.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/025-d7a5fec3775a.png\" \/><\/p>\n<p>And with that, a simple all-in-one workflow is complete.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/026-b442e61e11bf-scaled.png\" \/><\/p>\n<p>Next, let&#8217;s refine it further to make it more &#8216;user-friendly&#8217;.<\/p>\n<p>First, the prompts.<\/p>\n<p>The built-in workflow templates in ComfyUI actually thoughtfully provide a set of prompt technique notes next to them for users to learn and reference.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/027-abe2989a00d2.png\" \/><\/p>\n<p>But the learning curve is still a bit steep. Moreover, Kontext only supports English, which is quite stressful for users who aren&#8217;t proficient in English.<\/p>\n<p>So, what should we do?<\/p>\n<p>For problems like this, my usual solution is: integrate an LLM.<\/p>\n<p>The results of multimodal generation models are what you see is what you get, making them easier to understand and implement. But when it comes to true intelligence, large language models are the way to go. The higher training and inference costs of LLMs are not without reason. The more you use large models, the more you appreciate this point.<\/p>\n<p>We can directly build a &#8216;Prompt Generator&#8217;.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/028-e22e1c20b85e.png\" \/><\/p>\n<p>Input the &#8216;Prompt Techniques&#8217; from earlier as the system prompt to the LLM:<\/p>\n<pre><code>You are a 'Flux Kontext Prompt Generation Master', skilled at generating prompts that comply with Flux Kontext Prompt Techniques based on the user's described requirements.<\/code><\/pre>\n<p>Then, just upload the image and describe the desired changes in the simplest terms possible.<\/p>\n<p>For example, I input the requirement &#8216;Change her into a blue dress&#8217;.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/029-5530525b1259.png\" \/><\/p>\n<p>No need to worry about what changes and what stays the same, or whether the wording should be &#8216;she&#8217; or &#8216;the woman&#8217;; the LLM will handle everything according to the specifications.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/030-e1b9f97e2e21.png\" \/><\/p>\n<p>After the entire workflow runs, she is changed into a blue dress.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/031-a477b2003696.png\" \/><\/p>\n<p>Taking it a step further, if the original image is complex and a simple requirement description isn&#8217;t enough for the LLM to understand what should change, what should be preserved, and how to phrase it.<\/p>\n<p>We can also add the reverse-engineering module mentioned in the previous article, use a &#8216;String Merge&#8217; node to combine it with the original prompt, and also tell the LLM what&#8217;s in the image, so it can generate a more precise prompt.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/032-12841ff4524e.png\" \/><\/p>\n<p>Another example: the API nodes have a drawback; they only allow generation in a few fixed aspect ratios.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/033-cd41085cab27.png\" \/><\/p>\n<p>But the original images we upload could be horizontal or vertical, making adjustments inconvenient each time.<\/p>\n<p>How to make the aspect ratio adjust automatically? This can also be done using an LLM.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/034-685b24375c74.png\" \/><\/p>\n<p>First, we can use an &#8216;Image Size&#8217; node to read the image dimensions and output the width-to-height ratio, for example, the output in the image above is 2208:2994.<\/p>\n<p>Then, we can directly use the LLM to judge:<\/p>\n<pre><code>Please determine which of the following aspect ratios is closest to the image ratio I give you, and output (and only output) that ratio.<\/code><\/pre>\n<p>Output the closest size ratio.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/035-93ece21d82a0.png\" \/><\/p>\n<p>Then, connect this ratio to the API node&#8217;s aspect ratio parameter.<\/p>\n<p>Note that parameters can only be connected if their types match. Here&#8217;s a tip for confirming parameter types:<\/p>\n<p>Drag a connection line from the corresponding parameter to create a new node. At that point, you&#8217;ll see a hint about the parameter type. For example, in the image below, the parameter type for this ratio is: Combo.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/036-39219d3971eb.png\" \/><\/p>\n<p>So, we need to add a format conversion node between the string and the ratio parameter: String to Combo.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/037-583d8a7756b6.png\" \/><\/p>\n<p>This way, automatic aspect ratio adjustment is achieved.<\/p>\n<p>Let&#8217;s find a new case to run through.<\/p>\n<p>For instance, I want to keep the furniture and decoration of the room below unchanged, but make it more girly.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/038-34e42c9711c1.png\" \/><\/p>\n<p>Now, I just need to input the image processing requirement:<\/p>\n<pre><code>Keep the existing decoration and furniture, and style this room to be a cute girl's room.<\/code><\/pre>\n<p>The LLM automatically enriched the items for a girl&#8217;s room and required preserving the existing decoration and furniture:<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/039-fa02a950e025.png\" \/><\/p>\n<p>Then, it automatically recognized that the original image&#8217;s ratio was closer to a 3:4 vertical aspect, so the API image generation automatically outputs in a 3:4 ratio.<\/p>\n<p>Here are the final two images generated by the local model and the API:<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/040-cdd1f658bc69.png\" \/><\/p>\n<p>By analogy, we can also use image size acquisition for the multi-image reference mentioned earlier.<\/p>\n<p>The local Kontext model&#8217;s input and output images have the same aspect ratio. The multi-image processing method first combines them into one image before outputting, so the output image&#8217;s aspect ratio is the aspect ratio of the combined image.<\/p>\n<p>If both input images have backgrounds, they will usually be blended. But in cases like the example above where one stage has a white background, the result will likely still include a white background image in the output:<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/014-cedceced63d1.png\" \/><\/p>\n<p>To facilitate direct output, we can create a multi-image cropping function block here.<\/p>\n<p>Again, using the &#8216;Image Size&#8217; node, and without even needing an LLM, directly calculate the cropping position based on the original and generated image resolutions using arithmetic expressions, then perform the crop.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/042-cf2a7df27680.png\" \/><\/p>\n<p>The effect is as shown in the image below:<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/043-30a02aee1d2f-scaled.png\" \/><\/p>\n<p>Already 5000 words, space is limited, and what can be covered in the article is just the tip of the iceberg.<\/p>\n<p>However, if you are a ComfyUI beginner who has followed from the previous article to here, you should now have some ideas about Flux Kontext and building ComfyUI workflows.<\/p>\n<p>Based on actual usage needs, you can later add various function nodes and modules to the workflow, such as image upscaling, facial optimization, and more. You can even connect the ComfyUI workflow directly to Photoshop via the SD PPP plugin, integrating it into your daily image processing workflow.<\/p>\n<p><img decoding=\"async\" alt=\"\" loading=\"lazy\" src=\"https:\/\/blog.liu-qi.cn\/wp-content\/uploads\/2026\/04\/044-e010ece0596f-scaled.png\" \/><\/p>\n<p>These are left for you to explore on your own.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide demonstrates how to build custom ComfyUI workflows using the Flux Kontext model for efficient AI image generation and editing, with practical tips on integrating LLMs for smarter processes.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[8,7,6,13],"class_list":["post-70","post","type-post","status-publish","format-standard","hentry","category-articles","tag-ai-","tag-comfyui","tag-13"],"_links":{"self":[{"href":"https:\/\/en.blog.liu-qi.cn\/index.php\/wp-json\/wp\/v2\/posts\/70","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/en.blog.liu-qi.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/en.blog.liu-qi.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/en.blog.liu-qi.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/en.blog.liu-qi.cn\/index.php\/wp-json\/wp\/v2\/comments?post=70"}],"version-history":[{"count":0,"href":"https:\/\/en.blog.liu-qi.cn\/index.php\/wp-json\/wp\/v2\/posts\/70\/revisions"}],"wp:attachment":[{"href":"https:\/\/en.blog.liu-qi.cn\/index.php\/wp-json\/wp\/v2\/media?parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/en.blog.liu-qi.cn\/index.php\/wp-json\/wp\/v2\/categories?post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/en.blog.liu-qi.cn\/index.php\/wp-json\/wp\/v2\/tags?post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}