MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / renderInlineImage

Function renderInlineImage

cli/src/utils/terminal-images.ts:178–211  ·  view source on GitHub ↗
(
  base64Data: string,
  options: {
    width?: number
    height?: number
    filename?: string
  } = {},
)

Source from the content-addressed store, hash-verified

176 * @returns The escape sequence string, or null if not supported
177 */
178export function renderInlineImage(
179 base64Data: string,
180 options: {
181 width?: number
182 height?: number
183 filename?: string
184 } = {},
185): string | null {
186 const protocol = detectTerminalImageSupport()
187
188 switch (protocol) {
189 case 'iterm2':
190 return generateITerm2ImageSequence(base64Data, {
191 width: options.width,
192 height: options.height,
193 name: options.filename,
194 })
195
196 case 'kitty':
197 return generateKittyImageSequence(base64Data, {
198 width: options.width,
199 height: options.height,
200 })
201
202 case 'sixel':
203 // Sixel is more complex and requires actual image decoding
204 // For now, return null and fall back to metadata display
205 return null
206
207 case 'none':
208 default:
209 return null
210 }
211}
212
213/**
214 * Get a user-friendly description of the terminal image support

Callers 2

loadThumbnailFunction · 0.90
image-block.tsxFile · 0.90

Calls 3

Tested by

no test coverage detected