Fix RGB conversion (there was a bug due int division istead of float)

This commit is contained in:
mykola2312 2023-08-10 02:45:56 +03:00
parent 4013228679
commit 2c3186d94f

View file

@ -44,7 +44,7 @@ func getImage(name string) (E2Image, bool) {
}
func convertPixel(r uint32, g uint32, b uint32) (uint32, uint32, uint32) {
return (r / 0xFFFF) * 255, (g / 0xFFFF) * 255, (b / 0xFFFF) * 255
return uint32(float32(r) / 65535.0 * 255.0), uint32(float32(g) / 65535.0 * 255.0), uint32(float32(b) / 65535.0 * 255.0)
}
func handleImage(w http.ResponseWriter, r *http.Request) {