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

Function ResizeImageBase64

pkg/chat/image.go:183–193  ·  view source on GitHub ↗

ResizeImageBase64 is a convenience wrapper around ResizeImage that accepts and returns base64-encoded image data. The base64-encoded result is returned separately to avoid mutating the ImageResizeResult.Data field.

(b64Data, mimeType string)

Source from the content-addressed store, hash-verified

181// and returns base64-encoded image data. The base64-encoded result is returned
182// separately to avoid mutating the ImageResizeResult.Data field.
183func ResizeImageBase64(b64Data, mimeType string) (b64Result string, metadata *ImageResizeResult, err error) {
184 raw, err := base64.StdEncoding.DecodeString(b64Data)
185 if err != nil {
186 return "", nil, fmt.Errorf("decode base64: %w", err)
187 }
188 result, err := ResizeImage(raw, mimeType)
189 if err != nil {
190 return "", nil, err
191 }
192 return base64.StdEncoding.EncodeToString(result.Data), result, nil
193}
194
195// FormatDimensionNote produces a human-readable note describing the resize mapping.
196// This helps the model translate coordinates from the resized image back to the original.

Callers 1

TestResizeImageBase64Function · 0.85

Calls 1

ResizeImageFunction · 0.85

Tested by 1

TestResizeImageBase64Function · 0.68