11 Commits

Author SHA1 Message Date
Denys Smirnov
2701e9df15
Merge ed0c0d1c26b8a935a8625e5b198f4f27b173e264 into c8d2117f02bcad6d8316ffd8273bdc27adf83b44 2025-09-26 00:12:39 +08:00
Chenlei Hu
0fd4e6c778
Lint unused import (#5973)
* Lint unused import

* nit

* Remove unused imports

* revert fix_torch import

* nit
2024-12-09 15:24:39 -05:00
Denys Smirnov
20447e9ec9
Fix alpha in PorterDuffImageComposite. (#3411)
There were two bugs in PorterDuffImageComposite.

The first one is the fact that it uses the mask input directly as alpha, missing the conversion (`1-a`). The fix is similar to c16f5744.

The second one is that all color composition formulas assume alpha premultiplied values, while the input is not premultiplied.

This change fixes both of these issue.
2024-06-04 16:37:11 -04:00
Denys Smirnov
ed0c0d1c26 Allow joining a batch of images with a single mask
Previously, JoinImageWithAlpha required a batch of images to match a batch of masks. But for some use cases it's easier to provide a batch of images and a single mask.

This change automatically repeats the mask for all images in a batch.

In the same spirit, PorterDuffImageComposite will now allow a single mask for a batch of images (for both src and dst).

But also, PorterDuffImageComposite will apply the same logic to src and dst: if src contains one image, and dst is a batch it will repeat src to match dst (or the opposite).
2024-05-06 12:33:16 +03:00
comfyanonymous
c16f5744e3 Fix SplitImageWithAlpha and JoinImageWithAlpha. 2023-10-08 15:52:10 -04:00
comfyanonymous
0e763e880f JoinImageWithAlpha now works with any mask shape. 2023-10-04 15:54:34 -04:00
comfyanonymous
9212bea87c Change a few things in #1578. 2023-10-04 15:43:41 -04:00
MoonRide303
214ca7197e Corrected joining images with alpha (for RGBA input), and checking scaling conditions 2023-10-04 19:04:52 +02:00
MoonRide303
585fb0475b Adding default alpha when splitting RGB images 2023-10-04 19:04:52 +02:00
MoonRide303
ece69bf28c Change channel type to MASK (reduced redundancy, increased usability) 2023-10-04 19:04:52 +02:00
MoonRide303
d06cd2805d Added support for Porter-Duff image compositing 2023-10-04 19:04:48 +02:00