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

Function encodePNG

pkg/chat/image.go:278–285  ·  view source on GitHub ↗
(img image.Image)

Source from the content-addressed store, hash-verified

276}
277
278func encodePNG(img image.Image) ([]byte, error) {
279 var buf bytes.Buffer
280 if err := png.Encode(&buf, img); err != nil {
281 // Fallback: should not happen for RGBA images.
282 return nil, err
283 }
284 return buf.Bytes(), nil
285}
286
287func encodeJPEG(img image.Image, quality int) ([]byte, error) {
288 var buf bytes.Buffer

Callers 1

pickSmallestEncodingFunction · 0.85

Calls 1

BytesMethod · 0.95

Tested by

no test coverage detected