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

Function scaleImage

pkg/chat/image.go:252–256  ·  view source on GitHub ↗

scaleImage resizes img to the given dimensions using CatmullRom (bicubic) interpolation.

(img image.Image, w, h int)

Source from the content-addressed store, hash-verified

250
251// scaleImage resizes img to the given dimensions using CatmullRom (bicubic) interpolation.
252func scaleImage(img image.Image, w, h int) image.Image {
253 dst := image.NewRGBA(image.Rect(0, 0, w, h))
254 draw.CatmullRom.Scale(dst, dst.Bounds(), img, img.Bounds(), draw.Over, nil)
255 return dst
256}
257
258// pickSmallestEncoding encodes the image as both PNG and JPEG and returns whichever is smaller.
259func pickSmallestEncoding(img image.Image) ([]byte, string, error) {

Callers 1

ResizeImageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected