mirror of
https://github.com/gen2brain/cam2ip.git
synced 2025-12-16 04:18:39 +00:00
Update timestamp
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package image
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"image"
|
||||
"image/color"
|
||||
"image/draw"
|
||||
@@ -35,13 +34,15 @@ func Flip(img image.Image, dir string) image.Image {
|
||||
return img
|
||||
}
|
||||
|
||||
func Timestamp(img image.Image, format string) (image.Image, error) {
|
||||
func Timestamp(img image.Image, format string) image.Image {
|
||||
dimg, ok := img.(draw.Image)
|
||||
if !ok {
|
||||
return img, fmt.Errorf("camera: %T is not a drawable image type", img)
|
||||
b := img.Bounds()
|
||||
dimg = image.NewRGBA(image.Rect(0, 0, b.Dx(), b.Dy()))
|
||||
draw.Draw(dimg, b, img, b.Min, draw.Src)
|
||||
}
|
||||
|
||||
pixfont.DrawString(dimg, 10, 10, time.Now().Format(format), color.White)
|
||||
|
||||
return dimg, nil
|
||||
return dimg
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user