Closed anandijain closed 2 years ago
What about broadcast assignment (.=
)?
function blendem3(v, v2, mode=BlendHardLight)
img = similar(v[1])
for i in eachindex(v)
img .= blend.(v[i], v2[i], mode=mode) # reuses `img`
save("$i.jpeg", img)
end
end
If this is helpful to you, it would be worth adding that explanation to the documentation (https://kimikage.github.io/ColorBlendModes.jl/stable/blending-and-compositing/#Broadcasting).
Feel free to reopen this if you still need to blend!
.
Hello,
I haven't dug too much into internals, but I'm wondering how hard it would be to write a 3-arg inplace
blend!
function that the allocatingblend
uses. I'm mainly looking to blend videos, so reusing the memory from one frame to the next is my goal.This example might demonstrate what I'm thinking of (where v and v2 are equal lengths, of something like
Vector{Matrix{RGB{N0f8}}}
):There might be a way to do this without having to change this package, I'm not sure. Does this make any sense (ie will it cut down on allocations?)