MCPcopy Index your code
hub / github.com/docker/docker-agent / encodeJPEG

Function encodeJPEG

pkg/chat/image.go:287–293  ·  view source on GitHub ↗
(img image.Image, quality int)

Source from the content-addressed store, hash-verified

285}
286
287func encodeJPEG(img image.Image, quality int) ([]byte, error) {
288 var buf bytes.Buffer
289 if err := jpeg.Encode(&buf, img, &jpeg.Options{Quality: quality}); err != nil {
290 return nil, err
291 }
292 return buf.Bytes(), nil
293}

Callers 2

ResizeImageFunction · 0.85
pickSmallestEncodingFunction · 0.85

Calls 1

BytesMethod · 0.95

Tested by

no test coverage detected