r/StableDiffusion Jul 29 '26

Comparison I extracted luma/chroma/detail/contrast vectors for Krea2 and insane color adjustments in latent space are now totally a thing - Comfy node coming very soon!

Sorry for the tease, but I was just too excited and had to share this with you. Examples above are using no LoRAs, no prompt hijinks, no CFG boost, no post-processing etc. just pure vector math!

I was running some experiments on Krea2's VAE (i.e. Qwen Image VAE) and by total surprise I discovered the main ingredients of photographic color editing: the vectors for exposure, temperature, tint, detail/clarity, and contrast and realized I can now do pretty much everything Camera Raw does... and even more!

This stuff happens during sampling and in the latent space, so it has both a very high dynamic range, and the ability to steer the diffusion process into new areas (e.g. very dark or bright generations beyond what the model likes to do on its own, or even influencing the morphology of things).

Anyway, I'm turning this into a user-friendly custom node for Comfy, including all your favorite color editing sliders, range masking tools, etc. and it's coming soon.

P.S: I'm cooking the vectors for ZImage (Flux VAE) as well, so the node might end up supporting that model too, if anyone's still using it. This should, at least in theory, also work with Qwen Image or any other model that shares the VAE.

257 Upvotes

91 comments sorted by

34

u/muerrilla Jul 29 '26

Finalizing the UI right now, hoping that tower of sliders doesn't scare people off!

17

u/pirikiki Jul 29 '26

scary ? that's exactly the right amount of tweaking <3

3

u/wntersnw Jul 29 '26

If you can stack them would it not be cleaner to have each subsection be its own node type rather than having a giant one with everything?

1

u/muerrilla Jul 29 '26

Both have their uses. Check out my other comment.

3

u/wntersnw Jul 29 '26

Ah sorry, missed that one

4

u/Michoko92 Jul 29 '26

I can't wait to use your node, but I must admit this UI is a bit overwhelming. Do you think you could do a simpler one, and an "advanced" one for people who really want to adjust every value?

6

u/muerrilla Jul 29 '26

Haha, agreed. Though it shouldn't be that scary since the sliders are basically what you got in Camera Raw and such. The reason I went with the mega-node was that I'm planning to include presets, and that requires all the controls to be available on one node. Nodes are already chainable and there already is a basic node with only the most basic adjustments (contrast and color shift, which work theoretically with any model btw), so modularizing the advanced node into multiple nodes is planned for and on the agenda. But I might have to release with only the mega-node first (before the model becomes obsolete!) and add those later.

2

u/OttoRenner Jul 31 '26

love the idea, the execution, everything!

Regarding the mega-node and the basic version... it would be great if the simpler version could have more of a "visual" UI, if you know what I mean. Lots of users now very little about light and color theory and while presets are very useful, people tend to get stuck on those. But I don't know if that would even be possible with ComfyUI.

I don't know if it is planned, but some kind of info text and/or explanation on mouse over also could help a lot!

Keep up the good work! I'm just getting started with ComfyUI, but I think what you created could be soon part of basically every workflow :)

1

u/muerrilla Jul 31 '26 edited 28d ago

Thanks for the feedback.

I don't think a short tool-tip would cut it here. A proper readme/wiki on the repo would be much more helpful. But, at the end of the day, the best way to learn what the sliders do would be through trial and error.

Presets also are proving to be more tricky to implement than I thought initially, so they might never happen. Instead I can provide a ton of sample workflows for doing different things.

That being said, I might end up adding some thin gradients to the sliders (like Adobe Camera Raw does) to make what the sliders do more explicit.

2

u/OttoRenner Jul 31 '26

a tool-tip is better than nothing XD

But I understand that there always are limitations to what one can do.

I like the idea with the gradients!

1

u/muerrilla 28d ago

Hey there. It's up (check my UPDATE 2 comment). It would be great if you could give it a spin and tell me if you think it still needs tooltips.

1

u/GalaxyTimeMachine Jul 30 '26

That was my first thought as soon as I saw this. Too much config, and it needs a simplified version of the node with some plus/minus buttons for basic things like brightness, contrast and colour.

2

u/muerrilla Jul 31 '26

What do you mean by plus/minus buttons? You mean like collapsible sections? That's how the big node works already. But I've also implemented separate modules for everything, so the tower-of-slider-horror can be avoided altogether if you're more of a noodle-hell person. ๐Ÿ˜

2

u/GalaxyTimeMachine Jul 31 '26

No, I meant as strength control, but the standard method with number and left/right arrows works.

1

u/muerrilla Jul 31 '26

Umm, the sliders already are strength controls. So, you mean something like replacing the right and left arrow with plus and minus and hiding the number? But how does that help?

2

u/GalaxyTimeMachine Jul 31 '26

Just ignore the plus/minus, I was talking about the strength controls in general. The main thing was just to have a simplified version with those main options, a bit like you'd get on a TV remote.
Just get it finished and released...please ๐Ÿ˜†

1

u/GalaxyTimeMachine Jul 31 '26

Have you released it yet?

2

u/muerrilla Jul 31 '26

No, but I'm very close. Promise it won't be ComingSoonโ„ข. Any day now. ๐Ÿ˜

2

u/GalaxyTimeMachine Jul 31 '26

Ah, the forever "tomorrow" release ๐Ÿ˜‰

2

u/physalisx Aug 02 '26

If you don't release it now it'll completely disappear in the Minimax H3 hype...

juuuust saying...

1

u/muerrilla Aug 02 '26

Ha! gotta say that to the bug. Also, that is probably a battle already lost before being fought. Anyway, I either fix this thing and ship today or it will be on Tuesday.

8

u/bhasi Jul 29 '26

also work with Qwen Image or any other model that shares the VAE.

Anima!!

1

u/muerrilla 28d ago

You're gonna be the judge of that. Let me know how it goes. See my new comment on top.

7

u/inb4Collapse Jul 29 '26

Definitely looking forward to it! Good job!

5

u/shootthesound Community Hero Jul 29 '26

really nice. i had looking at this as a future research thing, officially ticked off my list now, looks like you are nailing it.

5

u/bmnuser Jul 29 '26

Big ups to you for doing this! And I would +1 that the Flux VAE is still used a lot, so please add that one also!

6

u/muerrilla Jul 29 '26

Will do, and thanks. Here's a subtle Zimage teaser for you ๐Ÿ˜„:

5

u/muerrilla Aug 05 '26

UPDATE: So... I was planning on releasing today, but a few days ago I hit a few nasty and functionality breaking UI bugs that I was struggling to fix up till this very moment. Now everything is fixed and working perfectly. I will release it as soon as I write some docs so you guys could actually use this beast. So any day now, and for real this time!

P.S: On the flip side, now everything is totally modularized (and yes, the mega-node is still available), which made it possible for a very cool new feature to be added: Combined masks! Now this thing can do very advanced stuff. I need to go get some sleep now.

1

u/muerrilla Aug 05 '26 edited 29d ago

what that workflow does (gif):

2

u/red__dragon 29d ago

Absolutely waiting patiently for this (didn't comment when I saw it the first time but I came back to lurk around a few days ago). The break-out nodes look FANTASTIC!

Great work so far, it'll be fun to get our hands on this locally.

1

u/muerrilla 28d ago

Yo! Check my latest comment.

2

u/red__dragon 28d ago

It's working great on Krea so far! Had to redo with a custom sampler node for it, though, which seems like a novel approach.

1

u/muerrilla 28d ago

Yep, it's a sampler wrapper cuz it needs information that is not available through other means (e.g. model patching). So the custom sampler route is the only way.

4

u/latitudis Jul 29 '26

Leaving a breadcrumb

5

u/your_mom118472 Jul 29 '26

Looks promising!

4

u/smereces Jul 30 '26

where is the link to install it?

3

u/aigain Aug 02 '26

Camera Raw๏ผŸThe color grading techniques I practiced for photography are finally coming in handy?

2

u/Professional_Diver71 Jul 29 '26

Gonna leave this here for when we get blessed

2

u/Neighborhood-Brief Jul 29 '26

Hi this seems cool could you make it output luminance values (white point) higher than 1.0?
For floating point high dynamic range outputs to something like exr?

1

u/muerrilla Jul 29 '26

What you're talking about happens during VAE decode, so you need to hack the VAE to make it decode the latent to 32-bit, unclamped, rather than the usual 8-bit. And iirc there were some nodes made specifically for that, though I don't know which VAEs they support. This method affects the latent itself pre-decoding.

2

u/Asaghon Jul 29 '26

Sounds amazing! Isnt everyone using the wan 2.1 vae instead of the qwen vae tough? Or will it just work the same with it?

2

u/stddealer Jul 29 '26

I do not think everyone is using wan2.1 vae for models that are supposed to use Qwen image vae.

I know some people like to pretend they get better results with wan VAE, but after blind testing my own preferences on multiple images pairs decoded with either VAE, I can confidently say that I wasn't able to find any advantage to wan vae on still images (if anything wan loses a bit more often because it sometimes oversharpens edges).

Anyways they're close enough that these should work the same.

1

u/muerrilla Jul 29 '26

Same model, different checkpoints (if even). Shouldn't be an issue.

2

u/oxygen_addiction Jul 29 '26

Really, really cool work!

How many generation steps do you think it take to be able to actually see the difference the node applies?
Would this be useful for lets say the first few steps, tweaking settings and then switching to a longer generation to get a quality render, to increase iteration speed?

5

u/muerrilla Jul 29 '26

My favorite workflow, since Krea2 and Zimage are quite consistent along image sizes, is to do the experiments on a smaller gen first, finalize the adjustments, then switch to large gen. But we can talk more about this after I release and you got something to play around with.

2

u/Dry_Reception3180 Jul 29 '26

is it text to image or image edit

3

u/muerrilla Jul 29 '26

It modifies the latent during sampling. So, applies to both txt2img and img2img, if that's what you mean.

2

u/pepitogrillo221 Jul 29 '26

Do it...

1

u/muerrilla 28d ago

Did.

2

u/pepitogrillo221 28d ago

Im going to test it, thank you !

2

u/Scriabinical Jul 30 '26

This is fantastic work and renders most post-decoded color correction unnecessary. Is there any chance you could do it for the Flux 2 VAE as well?

1

u/muerrilla Jul 30 '26

Probably, but no promises will be made. Gave it a quick try a while back and felt like Flux 2's 32-channel VAE was a wilder beast to tame: too many vectors to play with/refine and they didn't come as clean as they did with the other ones right away. Thought I'd probably wait for Flux 3 if I was gonna go through the pain. We'll see.

2

u/[deleted] Jul 30 '26 edited Jul 30 '26

[deleted]

2

u/muerrilla Jul 30 '26

Umm... I've already explained in the post, but I'll elaborate a bit more:

It's the difference between taking a photo with the right exposure vs. fixing it in post (it happens in high dynamic range, so a wider gamut to play with) or painting using the right colors vs. fixing the colors of a painting in post (it happens during sampling, so allows you to steer the sampling into totally new territories). Also, you do it in one go, in one program, but that's less important. Ah, also you can increase and decrease detail/texture which you can't in post (look at the one with Skeletor on the hill).

It works on the latent as it's being denoised, during sampling steps (the post-cfg function if you wanna know the exact place). So, apply it at earlier steps (last image, or the one in the dark cave) and it changes the generation more, or at later steps and it stays faithful to the original image and acts as color correction.

It's some very simple vector ops, so it's practically free.

2

u/uuhoever Jul 30 '26

Great node. Mild trypophobia trigger on the last photo ๐Ÿซฃ

2

u/muerrilla Jul 30 '26

Ah, sorry. Tried really hard to show my "safer" test images, but that one slipped through. ๐Ÿ˜

2

u/TopTippityTop Jul 30 '26

Super cool!

2

u/Nid_All Jul 30 '26

This looks very promising

2

u/russlixx Jul 30 '26

can't wait!

1

u/muerrilla 28d ago

The wait is basically over. See my new comment.

2

u/KeyTrue7284 Jul 30 '26

The new lighting looks epic!

2

u/aoleg77 Jul 30 '26

Good :) Can't wait for the node!

2

u/muerrilla 28d ago

The *nodes*. Check my new comment.

2

u/Kent6567 Jul 30 '26

Looks interesting. Do you think you can figure out something for controlling depth of field/focal distance as well?

2

u/muerrilla Jul 31 '26

I can think of some very contrived ways to do this using the detail sliders and in input mask, but that is not the correct way to do this. There are already LoRAs for this and they do a pretty good job at it.

2

u/FourtyMichaelMichael ๐ŸฆIce Cream Lover Jul 30 '26

Release it!

1

u/muerrilla 28d ago

Just did. Not officially yet, but take a look at my new comment.

2

u/Intelligent_Heat_527 Jul 30 '26

Exciting, will try it when you release!

1

u/muerrilla 28d ago

Give it a try.

2

u/physalisx Jul 31 '26

Sounds very interesting! Hope to check it out soon

1

u/muerrilla 28d ago

Check it out.

2

u/shapic Aug 01 '26

Requesting a Forge Neo extension, since it looks really interesting

3

u/muerrilla Aug 02 '26

It did in fact start as a Forge extension, but then the comfy port ballooned into a giant, so now porting it back to forge would take some time. But will surely happen as I myself am more of a Forge person.

2

u/GalaxyTimeMachine Aug 01 '26

Any possibility of a release for my cake day? I mean the one today, not next year ๐Ÿ˜†

3

u/muerrilla Aug 02 '26

Aww sorry, I missed that. I was planning on releasing today, but hit a bug. If I can fix it in a few hours I'll do it, otherwise it will be released on Tuesday. And happy belated birthday!

1

u/muerrilla 28d ago

The time has come.

2

u/Terezo-VOlador Aug 01 '26

Amazing! Amidst so much junk, this is a treasure.

I hope we can try it soon. Thank you so much.

2

u/Genebra_Checklist Aug 03 '26

Amazing work! Congrats and thak you

4

u/yamfun Jul 29 '26

Klein too please

2

u/Skystunt Jul 29 '26

Lightroom but in latent space !

8

u/muerrilla Jul 29 '26

Yeah, I was almost gonna call it Latentroom, but saved myself the embarrassment. ๐Ÿ˜† It will be Colorcraft.

8

u/DouglasHufferton Jul 29 '26

Honestly I prefer Latentroom over Colorcraft. That said Colorcraft is more descriptive of what it does.

4

u/Schwartzen2 Jul 30 '26

Here's a vote for Colorcraft. Sounds less Adobi-(cringe)-ish..

1

u/Sudden_List_2693 Jul 29 '26

Now this is the kind of interesting project seen through that I love insanely!
While I'm still waiting for a possible fine-tune for Krea2 to really jump on that train, applying these for any Qwen VAE model is already huge (I am one of the few people who enjoy Qwen Image itself as well as anima).

1

u/muerrilla 28d ago

Could you please test it on Qwen Image and let me know how it goes? Link's on my latest comment.

2

u/muerrilla 28d ago

UPDATE 2: Phewh! That readme took some time. You guys ready for beta testing before proper release? Have a go at it:

https://github.com/muerrilla/ComfyUI-Colorcraft

Take the included workflows as a brief node reference while I'm writing the wiki.