anthonynsimon / bild

Image processing algorithms in pure Go
MIT License
3.99k stars 213 forks source link

Canvas and layers feature #68

Open anthonynsimon opened 5 years ago

anthonynsimon commented 5 years ago

Would it be useful to have the functionality to layer changes on top of a canvas? Something like what most visual image editors do.

For example:

result := layer.Flatten(
    layer.Canvas(width, height, backgroundColor),
    layer.Layer(image, blendMode, opacity),
        ...
)

Or more concrete:

result := layer.Flatten(
    layer.Canvas(1280, 720, bg.Black),
    layer.Layer(img1, blend.Normal, 1.0),
    layer.Layer(blur.Gaussian(img1, 0.1), blend.Multiply, 0.5),
    layer.Layer(effect.Sharpen(img2), blend.SoftLight, 0.25),
)

This would require thinking about how to handle things like:

But let's discuss if this would be useful in first place, and if so for which use cases :)