new simple downscaling ideas

This commit is contained in:
2026-06-20 11:31:44 +03:00
parent 67ff655767
commit b75a8814a2
20 changed files with 395 additions and 65 deletions
+38
View File
@@ -0,0 +1,38 @@
package main
var (
x = flag.Int("x", 0, "")
y = flag.Int("y", 0, "")
size = flag.Int("size", 24, "size of font")
// img = flag.String("path", "", "path to image")
)
func main() {
flag.Parse()
f, err := truetype.Parse(gomono.TTF)
if err != nil {
panic(err)
}
face := truetype.NewFace(f, &truetype.Options{
Size: float64(img.Bounds().Dx() / size),
DPI: 72,
Hinting: font.HintingNone,
})
d := &font.Drawer{
Dst: dst,
Src: image.NewUniform(color.Black),
Face: face,
Dot: fixed.Point26_6{fixed.Int26_6(img.Bounds().Dx() /
x,
),
fixed.Int26_6(img.Bounds().Dy() /
y,
),
},
}
d.DrawString(time.Now().Format(time.Kitchen))
}