sksamuel / scrimage

JVM - Java, Kotlin, Scala image processing library
https://sksamuel.github.io/scrimage
Apache License 2.0
1.07k stars 140 forks source link

average implementation is not correct #279

Closed tonny008 closed 1 year ago

tonny008 commented 1 year ago

https://github.com/sksamuel/scrimage/blob/a5bd523e1beac9f25721fee9410e900c5bfe5eef/scrimage-core/src/main/java/com/sksamuel/scrimage/color/Color.java#L68-L82

rOut = (rA * aA / 255) + (rB * aB * (255 - aA) / (255*255))
gOut = (gA * aA / 255) + (gB * aB * (255 - aA) / (255*255))
bOut = (bA * aA / 255) + (bB * aB * (255 - aA) / (255*255))
aOut = aA + (aB * (255 - aA) / 255)
sksamuel commented 1 year ago

Can you make a PR ?

sksamuel commented 1 year ago

Thank you for the PR. Will merge and release.