Add opacity to stroke and fill colors, fix/enhance RGB to RGBA. #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, lovely simple but effective node you have. I was using (and had modified) https://github.com/sfinktah/ComfyUI_Comfyroll_CustomNodes but then it turned out for all it's complexity, it couldn't label videos. So your node was so beautifully simple after all that.
I wanted opacity on my outlined text (or stroked, as you call it).
In the process of implementing it a second time, I found out that opacity is fully supported by PIL text drawing, as long as you are writing to an RGBA image. Since the image we get is not RGBA, we quickly convert it to RGBA just long enough to composite a transparent layer (containing the possibly-transparent text/outline), then convert it back to whatever form it was for a tidy return.
Along the way, I fixed your RGB hex decoder (it was decoding #123 as #123123, rather than #112233) and enhanced it to also accept RGBA hex values (#8881 or #88888811).
I had however already created an extra input (stroke_opacity), which is what it will default to, if the alpha channel on the stroke isn't set.
That extra input could be removed, or another added for fill opacity.
I also changed the way you did font names, to the way they are done in comfyroll_customnodes: A font subdirectory with a "dropdown" list. That has the disadvantage of not letting you type arbitary font names that you have installed, but that's something that never seems to work right for me anyway. If you don't agree with that change, I can reverse that part.
In the future I might want to do something based on some python code I wrote read .PSD documents, and apply them in a layer-by-layer fashion, with text layers rendered using TTF. This involved determine the exact conversion of photoshops leading and line spacing parameters to PIL based functions. I recall also doing a QR code generator, but they may have been a bit of hack.
This is the kind of output it generated when mixed with live data. I think something similar might be of some use as a comfyui node.
Which was generated from a .PSD (via a
json
intermediate description)LMK if you'd be interested in something like this.