Visit ComfyUI Online for ready-to-use ComfyUI environment
Convert mask tensor to Base64-encoded image string for AI artists, enabling easy sharing and manipulation.
The MaskToBase64Image
node is designed to convert a mask tensor into a Base64-encoded image string. This transformation is particularly useful for AI artists who need to manipulate or share mask data in a more accessible and standardized image format. By converting the mask tensor into a Base64 string, you can easily embed the image data into web pages, JSON files, or other text-based formats without worrying about binary data handling. This node ensures that the mask, which is typically a single-channel image, is expanded into a three-channel color image, making it compatible with standard image viewers and editors.
The mask
parameter expects a tensor representing the mask image. This mask is typically a two-dimensional array where each value indicates the presence or absence of a feature in the image. The node processes this mask by reshaping it into a four-dimensional tensor, moving the channel dimension, and expanding it to three channels (RGB). This transformation ensures that the mask can be converted into a standard color image format. There are no specific minimum, maximum, or default values for this parameter, but it must be a valid mask tensor.
The output is a Base64-encoded string representing the mask image. This string can be easily embedded in HTML, JSON, or other text-based formats, making it convenient for sharing and storage. The Base64 string starts with a data URL prefix (data:image/png;base64,
) followed by the encoded image data. This format ensures compatibility with web browsers and other applications that support data URLs.
© Copyright 2024 RunComfy. All Rights Reserved.