ComfyUI > Nodes > ComfyUI-YCNodes > Image Mosaic

ComfyUI Node: Image Mosaic

Class Name

ImageMosaic

Category
YCNode/Image
Author
yichengup (Account age: 473days)
Extension
ComfyUI-YCNodes
Latest Updated
2025-06-03
Github Stars
0.02K

How to Install ComfyUI-YCNodes

Install this extension via the ComfyUI Manager by searching for ComfyUI-YCNodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-YCNodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Image Mosaic Description

Apply mosaic effect to images by dividing into blocks and replacing with single color, ideal for stylizing or anonymizing.

Image Mosaic:

The ImageMosaic node is designed to apply a mosaic effect to images, which is a popular technique used to obscure or stylize parts of an image by dividing it into smaller blocks and replacing each block with a single color. This effect is often used in digital art to create a pixelated look or to anonymize parts of an image. The node works by calculating the average color of each block and applying this color to the entire block, resulting in a distinctive mosaic appearance. This process can be particularly useful for artists looking to add a unique texture or pattern to their work, or for those who need to obscure sensitive information in an image while maintaining an artistic touch.

Image Mosaic Input Parameters:

image

The image parameter is the primary input for the ImageMosaic node, representing the image to which the mosaic effect will be applied. This parameter expects an image in the form of a tensor, which is a multi-dimensional array used to store the image data. The image should be in a format that the node can process, typically a torch tensor, ensuring that the image data is correctly interpreted and manipulated by the node.

mosaic_size

The mosaic_size parameter determines the size of the blocks used in the mosaic effect. It is an integer value that specifies how many blocks the image will be divided into along each dimension. A smaller mosaic_size results in larger blocks and a more pronounced mosaic effect, while a larger mosaic_size creates smaller blocks and a subtler effect. The parameter has a default value of 10, with a minimum value of 1 and a maximum value of 100. Adjusting this parameter allows you to control the granularity of the mosaic effect, tailoring it to your specific artistic needs.

Image Mosaic Output Parameters:

IMAGE

The output of the ImageMosaic node is an IMAGE, which is the processed image with the mosaic effect applied. This output is a torch tensor that represents the modified image data, ready for further processing or display. The mosaic effect alters the visual appearance of the image by replacing each block with its average color, resulting in a pixelated look that can be used for artistic or privacy purposes.

Image Mosaic Usage Tips:

  • Experiment with different mosaic_size values to achieve the desired level of detail in your mosaic effect. Smaller values will create a more abstract and pixelated look, while larger values will retain more of the original image's detail.
  • Use the ImageMosaic node in combination with other image processing nodes to create complex and layered effects. For example, applying a mosaic effect followed by a color adjustment can yield interesting artistic results.

Image Mosaic Common Errors and Solutions:

"Input must be torch.Tensor type"

  • Explanation: This error occurs when the input image is not in the expected torch tensor format.
  • Solution: Ensure that the image you provide to the node is converted to a torch tensor before input. You can use libraries like PyTorch to handle this conversion.

"Mosaic size must be an integer between 1 and 100"

  • Explanation: This error indicates that the mosaic_size parameter is set to a value outside the allowed range.
  • Solution: Adjust the mosaic_size parameter to be within the range of 1 to 100. This ensures that the node can correctly process the image and apply the mosaic effect.

Image Mosaic Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-YCNodes
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.