Nodes/comfy-plasma/Image To The Power Of
ComfyUI Node

Image To The Power Of

A per-pixel power curve for gamma-style tweaks — bring coffee at 4K

By Jordach·Created 3 years ago·Updated 2 years ago· 81
Image To The Power Of
  • IMAGE
  • IMAGE
power_of1.00
mode

JDC_PowerImage ("Image To The Power Of") applies a per-pixel power curve to an image: it raises each channel's brightness to a power and multiplies it back in. That's the same math gamma correction uses, which means it can darken shadows, lift highlights, or do both - depending on which of its three modes you pick. It's a tone-curve tool wearing a math professor's hat.

It's part of comfy-plasma by Jordach, and it's the pack's most unusual post-processing node, because it's also the pack's slowest.

How it works

For every pixel, each channel gets transformed based on the mode you select (with power_of defaulting to 1, which means "no change"):

  • darken - channel *= pow(channel / 255, power_of). For power_of > 1, values below 255 shrink, so the image darkens - mids pull down toward black harder than near-white values. This is effectively a gamma-style shadow deepen.
  • lighten - channel *= 1 + pow(channel / 255, power_of). The same curve is now added to the original value, so everything brightens.
  • emphasize both - channel *= 0.5 + pow(channel / 255, power_of). A blend of the two: dark values go darker, bright values go brighter, so you get an S-curve-style contrast push.

All results are clamped to 0–255, so nothing overflows into garbage. power_of can go from 1 up to 65536, though realistically you'll live in the 1–8 range - past that the curves get aggressive fast.

The honest catch: it's slow

Read the source and you'll see the cost. It's a nested Python loop over every pixel doing getpixel / putpixel calls - no vectorized torch, no PIL filter - with a progress bar so you can watch it crawl. At 512×512 that's 262,144 individual pixel operations, which is tolerable. At 2K or 4K you're into genuinely annoying wait times. ComfyUI's own image-math nodes (or a quick gamma via a different utility) will do the same job in a fraction of the time.

So when should you still reach for it? When you want exactly this three-way darken/lighten/both behavior as a drop-in node and you're working at modest resolution. It's not the tool for batch-processing 4K renders.

Inputs & install

IMAGE, power_of (float, 1–65536, default 1), and mode (darken / lighten / emphasize both). Output is a single IMAGE.

No requirements.txt, no models. ComfyUI Manager → Install Custom Nodes → search comfy-plasma → install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Jordach/comfy-plasma

Restart ComfyUI. It's under image/postprocessing.

Common issues

The two things that bite people:

  • Forgetting which mode you're in. power_of = 2 in darken mode darkens; in lighten mode it brightens. If the result looks backwards from what you expected, check the mode, not the power.
  • The speed. At high resolution this node can genuinely stall your workflow. If it's taking forever, downscale first, apply the curve, upscale back - the curve is resolution-independent math, so you lose nothing.
Categoryimage/postprocessing

Inputs (3)

NameTypeDefaultDescription
IMAGEIMAGE
power_ofFLOAT1.001–65536
modeCOMBO3 options: darken, lighten, emphasize both

Outputs (1)

NameTypeDescription
IMAGEIMAGE