diff --git a/README.md b/README.md index a74323d..5a51bb1 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ Example : Blends three random pictures stored in specified folder, using averagi # Resources - [image package documentation on pkg.go.dev](https://pkg.go.dev/image) +- [github - phrozen's blend package](https://github.com/phrozen/blend/blob/master/blend.go) - [Sighack - Averaging RGB Colors the Right Way](https://sighack.com/post/averaging-rgb-colors-the-right-way) - [Sau Sheong - Image processing with Go](https://go-recipes.dev/more-working-with-images-in-go-30b11ab2a9f0?gi=3bb0ce492e2e) - [Damitha Dayananda - Image Processing With GoLang](https://medium.com/@damithadayananda/image-processing-with-golang-8f20d2d243a2) +- [Image blending using pyramid](https://compvisionlab.wordpress.com/2013/05/13/image-blending-using-pyramid/) +- [Nancy Jo Ward | MA Digital Fine Arts - Blend Modes = Algorithms Explained](https://nancyjoward.wordpress.com/2018/04/17/blend-modes-algorithms-explained/) diff --git a/blend.go b/blend.go index 8791741..8c4b7bd 100644 --- a/blend.go +++ b/blend.go @@ -207,6 +207,10 @@ func lighten(fc uint8, bc uint8, fa uint8) float64 { return math.Max(float64(fc), float64(bc)) } +func multiply(fc uint8, bc uint8, fa uint8) float64 { + return float64(fc) * float64(bc) / 255 +} + // produce absolute garbage func fuckyfun(fc uint8, bc uint8, fa uint8) float64 { return float64((fc * fa) + (bc * (fa * 2))) @@ -220,8 +224,10 @@ func blend(fc uint8, bc uint8, fa uint8, ba uint8) float64 { newValue = darken(fc, bc, fa) case "average": newValue = average(fc, bc, fa) - case "ligten": + case "lighten": newValue = lighten(fc, bc, fa) + case "multiply": + newValue = multiply(fc, bc, fa) case "fuckyfun": newValue = fuckyfun(fc, bc, fa) default: