MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / processImageFile

Function processImageFile

src/core/tools/helpers/imageHelpers.ts:150–164  ·  view source on GitHub ↗
(fullPath: string)

Source from the content-addressed store, hash-verified

148 * Processes an image file and returns the result
149 */
150export async function processImageFile(fullPath: string): Promise<ImageProcessingResult> {
151 const imageStats = await fs.stat(fullPath)
152 const { dataUrl, buffer } = await readImageAsDataUrlWithBuffer(fullPath)
153 const imageSizeInKB = Math.round(imageStats.size / 1024)
154 const imageSizeInMB = imageStats.size / (1024 * 1024)
155 const noticeText = t("tools:readFile.imageWithSize", { size: imageSizeInKB })
156
157 return {
158 dataUrl,
159 buffer,
160 sizeInKB: imageSizeInKB,
161 sizeInMB: imageSizeInMB,
162 notice: noticeText,
163 }
164}
165
166/**
167 * Memory tracker for image processing

Callers 2

handleBinaryFileMethod · 0.90
executeLegacyMethod · 0.90

Calls 3

tFunction · 0.90
statMethod · 0.80

Tested by

no test coverage detected