To use a transparent PNG’s alpha as a mask in ComfyUI, load the file with LoadImage and use its optional MASK output as the starting point for a downstream mask workflow. Before connecting it, check the receiving node’s documentation and input requirements; a MASK label is a starting compatibility clue, not by itself proof that every downstream node accepts the output as intended. Use IMAGE separately when the workflow also needs the visible picture. First confirm the PNG contains actual transparency: a checkerboard in a preview can be a display convention, not proof that the file has alpha data.
Check the source file
Open the exact PNG you plan to load in an editor that can display transparency, and inspect it over a contrasting background. Look for both transparent and opaque areas. If the editor exposes an alpha-channel view or pixel values, use it to distinguish partial transparency from full opacity. Do not infer alpha from a checkerboard baked into the pixels, a dark preview canvas, or the .png extension alone.
This distinction determines whether the workflow can work as intended. ComfyUI’s LoadImage documentation describes its MASK output as optional and associated with images that include an alpha channel. It does not describe an automatic conversion of arbitrary black-and-white image content into a mask. See the official LoadImage documentation.
Connect the two outputs
- Add or select LoadImage and choose the PNG you inspected.
- Treat IMAGE as the processed picture output. Connect it to an IMAGE input if a later node needs the visible image.
- Treat MASK as the optional mask output associated with the image’s alpha. Connect it to a downstream socket that expects MASK, not to an IMAGE socket.
- Inspect the downstream node’s documentation and input requirements before connecting. If that workflow accepts a
MASKoutput, useLoadImage.MASKat its mask input; treat the type label as a compatibility clue and confirm the node-specific requirement rather than assuming that everyMASKinput behaves identically. The image and mask are separate outputs and can be used together when the workflow supports both. - Preview or otherwise inspect the mask in the consuming workflow. Confirm that the transparent region and opaque subject correspond to the mask interpretation that workflow expects.
The documentation identifies the output types, but does not specify a universal preview method or promise a particular downstream convention for whether white means included or excluded. Check the receiving node’s documentation or visible result before relying on mask polarity.
Use a concrete acceptance check
The following values are hypothetical observations for a simple test asset, not measured ComfyUI results. They illustrate what to inspect: a white square subject on a transparent canvas, with no soft edges.
| Test area in source | Hypothetical source alpha | What to check in the resulting mask | Decision |
|---|---|---|---|
| Center of opaque square | 255 (fully opaque) | Mask differs from the transparent area | Subject is represented distinctly |
| Empty corner | 0 (transparent) | Mask differs from the opaque center | Transparency is contributing to the mask |
| Soft edge, if present | Between 1 and 254 | The boundary is not reduced to an unexpected solid block | Check whether partial values suit the receiving node |
This comparison is more useful than judging the mask from its thumbnail alone. Use whatever mask-preview or inspection tool the workflow provides; ComfyUI’s LoadImage documentation does not specify a universal preview control. If no direct preview is available, verify the known transparent and opaque areas through the observable result of the receiving node. If that node treats white and black in the opposite way from your intention, consult its instructions. Do not assume that the LoadImage output itself should be inverted.
Diagnose a missing or wrong mask
If the mask output is absent, unavailable, or does not separate the intended regions, check the file’s alpha in an image editor first. A PNG can be entirely opaque; in that case, there is no transparent region for this method to use. If the file has no alpha, or its alpha is fully opaque, make or obtain an asset with the intended transparency and load that asset. Do not mistake a visible black background for transparency.
If a mask exists but the downstream result looks wrong, verify that you connected MASK, rather than IMAGE, and that the destination input is actually typed MASK. Then compare one known transparent pixel and one known opaque pixel against the result. If those regions are represented but the effect is reversed, check the receiving node’s mask convention. The supplied LoadImage documentation does not establish a universal polarity rule.
Common questions
Should I use ImageToMask instead?
Not for the specific task of using an existing PNG alpha directly. This guide uses LoadImage’s optional MASK output. A channel-conversion workflow is a different operation and is not required just to obtain the alpha-associated output described by the documentation.
Should I add InvertMask?
Only if the intended result requires the opposite mask interpretation and the receiving workflow calls for inversion. First inspect the actual result and the destination’s convention. Inversion is a separate adjustment, not a prerequisite for reading alpha.
What if the PNG looks transparent but the mask is solid?
Check whether transparency is real file data or merely the preview background. Inspect the file’s alpha, then confirm that the selected file in LoadImage is the same one you checked. A fully opaque image provides no transparent area for this approach to distinguish.
How do I tell whether the downstream result needs inversion?
First compare one known transparent area and one known opaque area with the receiving node’s result, using the inspection or preview method available in that workflow. If the regions are distinguished but their effect is opposite to the intended result, check that node’s documented mask convention and use InvertMask only when that workflow requires it. LoadImage’s documentation does not define a universal polarity rule for downstream nodes.
Scope and sources
This procedure uses alpha-associated masking from LoadImage; it does not extract an arbitrary RGB channel, define a universal white-versus-black mask convention, or guarantee how a particular downstream node applies partial transparency. The official documentation describes LoadImage as returning a processed IMAGE and an optional MASK for images that include alpha. For output types and the alpha condition, consult the LoadImage node reference.
Sources and next step
This guide interprets public documentation and uses explicitly hypothetical acceptance examples, not application tests. Controls and availability can change; verify the cited manual against your installed version.
For work created in Imagild, carry the input requirements and acceptance checklist into the photo editor. The external software controls discussed above belong to their respective products.