update to latest

This commit is contained in:
2026-06-02 10:08:24 +06:30
parent ecb03c1fb7
commit d7ffc17d71
9 changed files with 98 additions and 296 deletions

View File

@@ -91,7 +91,8 @@ func toMonochrome(img image.Image) *image.Gray {
for y := bounds.Min.Y; y < bounds.Max.Y; y++ {
for x := bounds.Min.X; x < bounds.Max.X; x++ {
r, g, b, _ := img.At(x, y).RGBA()
grayValue := uint8((r + g + b) / 3 >> 8)
// grayValue := uint8((r + g + b) / 3 >> 8)
grayValue := uint8((0.299*float64(r) + 0.587*float64(g) + 0.114*float64(b)) / 256.0)
if grayValue > 128 {
gray.Set(x, y, color.White)
} else {
@@ -138,7 +139,6 @@ func escposRaster(img *image.Gray) []byte {
data = append(data, b)
}
}
return data
}