mikey_nodes

mikey_nodes
★ 183

提示工程SDXL工具图像预处理色彩校正
为ComfyUI提供一组实用节点:强化Prompt管理与SDXL兼容、图像缩放、色彩校正及带提示保存,简化工作流。
💡 在生成前处理图像、管理Prompt并保存含元数据的结果,提升SDXL流程效率。
🍴 25 Forks💻 Python🔄 2025-10-03
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/c73fe210bae7
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
image
📄 README

Mikey Nodes

This repository contains custom nodes for ComfyUI.

Prompt With Style

Example workflow in the prompt_with_styles.json file and mikey_node_workflow.json

This node allows you to prompt with a style and loras. You can add a lora with or syntax for a weight of 0.8 as an example.

You can add styles by using the syntax.

Some of the styles built in are:

SAI-Enhance, SAI-Anime, SAI-Photographic, SAI-Digital art, SAI-Comic book, SAI-Fantasy art, SAI-Analog film, SAI-Neonpunk, SAI-Isometric, SAI-Lowpoly, SAI-Origami, SAI-Line art, SAI-Craft clay, SAI-Cinematic, SAI-3d-model, SAI-pixel art, SAI-Texture, photographic, deep-field, analog-film, cinematic, red, documentary, nature-photography, editorial, polaroid, 3d-model, low-poly, modeling-compound, diorama, miniatures, abstract, anime, comic-book, digital-art, fantasy-art, dark-fantasy, oil-painting, watercolor, charcoal, color-pencil, crayon, cross-stitch, felt, origami, scrapbook, isometric, line-art, vector-art, neon-punk, pixel-art, tile-texture, lithography, mosaic, woodblock-print, sticker, stained-glass, tattoo, statue, album-art, wes-anderson, vaporwave, clarendon, gingham, juno, lark, nonagon, kaleidoscope, haunting, glam, mecha, padam, collage, paper-mache, macrame, quilling, pottery, batik, felting, marquetry, wildstyle-graffiti, bubble-graffiti, stencil-graffiti, throw-up-graffiti, tag-graffiti

There is a V1 and V2 Prompt with Style node with different functionality, style selection instead of style syntax, no clip conditioning. Check them out if you like to break your workflow up into more nodes.

Wildcards

Wildcards are supported using the __word__ syntax. Folder location is comfyui/wildcards You can select more than 1 line from the wildcard by using the syntax 2$$__wildcard__ for 2 lines in this example. You can also add a word to search for in the wildcard file e.g. __wildcard|word__

You can also make sure it selects the same line from the wildcard by using the __!wildcard__ syntax, not the ! before the filename. You can also use __+wildcard__ __-wildcard__ and __*wildcard__ to use the offset + 1 or – 1, or randomly select a different line.

Styles

You can add your own styles to a file named user_styles.json in the root ComfyUI folder. You have to create this file yourself.

The format needs to look like the following example:

{
    "styles": {
        "newspaper": {
        "positive": "newspaper comic strip, panels, black and white",
        "negative": "photograph, color"
        }
    }
}

Image Size Ratios

You can also add your own custom ratios to a file named user_ratios.json in the root ComfyUI folder. You have to create this file yourself.

The format needs to look like the following example:

{
    "ratios": {
        "test": {"width": 1024, "height":  1024}
    }
}

Mikey Sampler and Mikey Sampler Base Only

Example workflow: mikey_node_workflow.json

This is a sampler node as a companion to the Prompt with Style node, to allow for very straightforward image generation with SDXL.

The node uses a base -> refiner -> upscale with model -> base to produce the final image. It has an inbuilt image complexity detection function to make sure there aren’t too many steps run on the final base sampler which can scramble faces and other simple areas on a large image.

The Base Only version of the sampler uses a slightly different approach. It uses a base -> base -> upscale with model -> base to produce the final image.

The other key difference with the Base Only version is it skips a step in the middle and adds it to the end. This is a trick which adds extra detail to the image. The smooth step number will add even more extra steps to the end. This might be required if you have an image with a plain background and are seeing some spotty effects created by the skip step method. Usually only 1 extra step is required to clean up the spots. You can also go -1 for very busy images for even more detail.

model_name is for the image uspcale model. These can be found at OpenModelDB and place them in the ComfyUI\models\upscale_models directory. I recommend lollipop as it provides a good balanced image that is not too sharp. If you want lots of sharp details, then try the NMKD Superscale or 4x-UltraSharp.

The seed is used by the samplers.

The upscale_by setting is how large you want the final image to be before it runs the last base sampler over the image. A value of 1 will output the original image size. 2 will be 2x the size of the original.

The highres_strength setting allows you to control this last stage and how much detail it adds. Setting of 1 is the sweet spot I found didn’t scramble faces in a few test images. Dial it down if you are still getting scrambled images, or turn it up if you want to add more detail.

Mikey Sampler Tiled and Mikey Sampler Tiled Base Only

These samplers use a tiled approach to resample the image after the upscale model has upscaled the image, to help enhance the image with more details.

Style Conditioner

This chonky node is for injecting the style prompt into your conditioner by averaging the conditioner passed through the node.

A strength value of 0.5 would be even split between the conditioner passed in and the style selected.

Empty Latent Ratio Select SDXL

This node allows you to select from a range of different aspect ratios.

Empty Latent Ratio Custom SDXL

This node allows you to enter your own aspect ratio or image size from wherever, and it will make it fit under 1024×1024 resolution.

Preset Ratio Selector

This node will read an optional user_ratio_presets.json file in the root directory of ComfyUI. This is an example of a preset:

{
    "ratio_presets": {
        "1024x1024 (AR 1:1 / DEC 1.0:1)": {
            "custom_latent_w": 1024,
            "custom_latent_h": 1024,
            "cte_w": 1024,
            "cte_h": 1024,
            "target_w": 4096,
            "target_h": 4096,
            "crop_w": 0,
            "crop_h": 0
        },
}

There is a file created by masslevel included in mikey_nodes directory called ratio_presets.json. It contains all of the recommended resolutions from SAI and the correct clipt text encoder and target sizes. This file will automatically be read and populated into the selection widget.

It is a really powerful and convenient ratio selector, because you can create all sorts of combinations for the latent image size, clip text encoder image size, target size and crop coordinates.

The swap axis option will rotate the dimensions by 90 degrees if set to true.

If use preset seed is set to true, it will use the seed number to select one of the available presets. This can be used to cycle or randomly select presets, which is super convenient.

Ratio Advanced

This node is the big brother to Preset Ratio Selector. It let’s you select a preset like with Preset Ratio Selector, but there is also lots of options for customisation.

When creating a latent image you need to set the width and height. But the Clip Text Encoder for SDXL Base Model also requires width and height, target width and height, and crop width and height.

This node has options to setup the dimensions for each of these using different methods:

  • Select a ratio from the select widget, or choose custom to enter your own dimensions.
  • If you select custom, you need to fill in the width and height options.
  • If you enter a number into the mult input e.g. cte_mult (clip text encoder) it will multiply the latent width and height to create the width and height for that dimension.
  • If you enter a number into the res input, it will create a width and height that fits into the res^2 image size while maintining the same ratio as the latent width and height.
  • If you enter a number into the fit_size input, it will create a width and height that has the largest dimension equal to fit_size while maintaining the same ratio as the latent width and height.
  • Resize Image for SDXL

    This node allows you to resize an image to fit into 1024×1024 resolution. Good for Img2Img workflows.

    Batch Resize Image for SDXL

    Given a path to a folder containing images, it will resize all images in the folder to fit the 1024^2 resolution and feed into the workflow. Careful of folders with lots of images!

    Save Image With Prompt Data

    This node allows you to save an image with the prompt data in the filename.

    The filename will start with a datestamp, then part of the positive prompt.

    It will also save the positive prompt and negative prompt to the png data.

    Upscale Tile Calculator

    Made for the Ultimate SD Upscaler to help calcuate tile size to evenly fit inside the larger image and not get weird edges.

    The resolution is what is suitable for the model you are using, 1.5: 512, 2.1: 768, SDXL Base: 1024, SDXL Refiner: 768

    Wildcard Processor

    This node is for building a string using your wildcard files.

    Add Metadata

    I want to give a shout-out to masslevel on discord for the great idea to have nodes for metadata.

    This node lets you add more metadata to the image that is passed through this node in your workflow. The metadata should be written to the image file in the Save Image node.

    The label is the key or label you want to give to the metadata, and the text box is for entering a value. Convert these to inputs if you want to pipe in string values from other nodes.

    Save Metadata

    This node should pick up the info stored in the prompt and extra_pnginfo data and save it to a txt file

    HaldCLUT

    This will apply a HaldCLUT to an image to change the colors, which tend to imitate the look of the film or filter. I have included some in this package, but you can find more png files at rawtherapee.com

    Image Caption

    This node will add a caption bar to the bottom of the image. Useful for adding a prompt or the name of the checkpoint to the image.

    If you create a font folder in the base directory of comfyui e.g. C:\ComfyUI\fonts and place ttf files in that folder, the widget will automatically be a drop down selection with the files in that directory. Otherwise it will be a text input for you to put the full path to the font file.

    Seed String

    This node creates a random number or Seed. It outputs the seed as a Integer and also a String version which can be used to add to metadata or wherever you want.

    Int to String

    Converts an integer to a string.

    Float to String

    Converts a float to a string.

    Additional Nodes

    The following nodes are newly added and not yet fully documented above:

  • Range Float / Range Integer – Generate numbers from a given range using the seed offset.
  • Save Image If True – Saves the image only when a given save condition is met.
  • Batch Crop Image / Batch Crop Resize Inplace – Process images in batches with cropping (and optional resizing).
  • Batch Load Images / Load Image Based on Number – Load images from a directory either as a batch or based on a seed index.
  • LoraSyntaxProcessor / WildcardAndLoraSyntaxProcessor – Process LoRA and wildcard syntax in prompts.
  • Prompt With SDXL – An alternative prompt node tailored for SDXL using style and prompt adjustments.
  • Style Conditioner Base Only – Injects style prompt conditioning into the base clip only.
  • Mikey Sampler Tiled Advanced / Mikey Sampler Tiled Advanced Base Only / Mikey Sampler Base Only Advanced – Advanced variations of the sampler nodes with refined control.
  • MikeyLatentTileSampler / MikeyLatentTileSamplerCustom – Perform tiling in latent space for upscaling.
  • FaceFixerOpenCV – Detect and fix faces using OpenCV.
  • SearchAndReplace – Searches a text for placeholders and replaces them.
  • FileNamePrefix / FileNamePrefixDateDirFirst – Generate filename prefixes for saving images with metadata.
  • ImageBorder / ImagePaste – Add borders to or paste images together.
  • TextCombinations2 / TextCombinations3 / Text2InputOr3rdOption – Combine multiple text inputs in various ways.
  • Checkpoint Loader Simple Mikey / CheckpointHash – Load checkpoints and compute their file hashes.
  • SRStringPromptInput / SRIntPromptInput / SRFloatPromptInput – Add prompt-related inputs with different data types.
  • TextPreserve / TextConcat / RemoveTextBetween – Manipulate and combine text strings.
  • OobaPrompt / WildcardOobaPrompt / LMStudioPrompt – Prompt processing nodes that integrate with external LLM services.
  • EvalFloats – Evaluate mathematical expressions given two floats.
  • ImageOverlay / CinematicLook / MosaicExpandImage – Various nodes for merging and stylizing images.
  • GetSubdirectories – Retrieve subdirectories from a given directory.
  • TextPadderMikey – Pad text to a fixed length.
  • SD3TextConditioningWithOptionsOnePrompt – Text conditioning with additional configurable options.
  • ModelMergePixArtSigmaXL2_1024MS / ModelMergeTrainDiff / ModelMergeTrainDiffPixartSigmaXL2_1024MS – Nodes for merging models.
  • CheckpointSaveModelOnly – Save checkpoints without additional output.
  • Feel free to expand the descriptions as you update each node.

    Installation

    To use these nodes, simply open a terminal in ComfyUI/custom_nodes/ and run:

    git clone https://github.com/bash-j/mikey_nodes

    License

    This project is licensed under the MIT License – see the LICENSE file for details.