use jpeg instead of png for screenshots
This commit is contained in:
parent
e76a52a3ea
commit
a3b93a2059
14
main.go
14
main.go
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
"golang.org/x/net/websocket"
|
||||
"image/png"
|
||||
"image/jpeg"
|
||||
"net/http"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
|
@ -269,20 +269,16 @@ func ws(c echo.Context) error {
|
|||
return errors.New("Capture error")
|
||||
}
|
||||
|
||||
var quality png.CompressionLevel
|
||||
var quality int
|
||||
|
||||
if data.Quality == "lq" {
|
||||
quality = png.BestCompression
|
||||
quality = 10
|
||||
} else {
|
||||
quality = png.NoCompression
|
||||
}
|
||||
|
||||
enc := &png.Encoder{
|
||||
CompressionLevel: quality,
|
||||
quality = 90
|
||||
}
|
||||
|
||||
buff := new(bytes.Buffer)
|
||||
enc.Encode(buff, img)
|
||||
jpeg.Encode(buff, img, &jpeg.Options{Quality: quality})
|
||||
|
||||
sendMessageResponse(ws, MessageResponse{
|
||||
Type: "screenshot",
|
||||
|
|
Loading…
Reference in a new issue