LogoSkills

inspector:image

Image cache and memory runtime analysis

ํ•ญ๋ชฉ๋‚ด์šฉ
Invoke/inspector:image
Categorykobic-development
Complexitysimple
MCP Serversflutter-inspector

/inspector:image โ€” ์ด๋ฏธ์ง€ ๋ฉ”๋ชจ๋ฆฌ ์ง„๋‹จ#

ํ•œ๋งˆ๋””๋กœ#

์•ฑ์ด ๋ณด์—ฌ์ฃผ๋Š” ์‚ฌ์ง„๋“ค์ด ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ์–ผ๋งˆ๋‚˜ ์žก์•„๋จน๊ณ  ์žˆ๋Š”์ง€ ๋“ค์—ฌ๋‹ค๋ณด๋Š” ์ฒญ์ง„๊ธฐ์ž…๋‹ˆ๋‹ค. ๋ƒ‰์žฅ๊ณ ์— ์Œ์‹์ด ๋„ˆ๋ฌด ๊ฝ‰ ์ฐผ๋Š”์ง€, ์ƒํ•œ ๊ฒŒ ์žˆ๋Š”์ง€ ์—ด์–ด๋ณด๊ณ  ์ •๋ฆฌํ•ด ์ฃผ๋Š” ๊ฒƒ๊ณผ ๊ฐ™์•„์š”.

๋ˆ„๊ฐ€ยท์–ธ์ œ ์“ฐ๋‚˜์š”#

  • ์•ฑ์ด ๊ฐ‘์ž๊ธฐ ๋А๋ ค์ง€๊ฑฐ๋‚˜ "๋ฉ”๋ชจ๋ฆฌ ๋ถ€์กฑ" ๊ฒฝ๊ณ ๊ฐ€ ๋œฐ ๋•Œ
  • ์ด๋ฏธ์ง€๊ฐ€ ์ž˜ ์•ˆ ๋œจ๊ฑฐ๋‚˜ ๋กœ๋”ฉ์ด ๋‹ต๋‹ตํ•˜๊ฒŒ ๋А๋ฆด ๋•Œ
  • ์‚ฌ์ง„์ด ๋งŽ์ด ๋“ค์–ด๊ฐ„ ํ™”๋ฉด์—์„œ ์•ฑ์ด ๋ฉˆ์ถ”๊ฑฐ๋‚˜ ๊บผ์งˆ ๋•Œ(๋ฉ”๋ชจ๋ฆฌ ์ดˆ๊ณผ)

๋ฌด์—‡์„ ํ•ด์ฃผ๋‚˜์š”#

  • ์ง€๊ธˆ ์ด๋ฏธ์ง€ ์บ์‹œ๊ฐ€ ์–ผ๋งˆ๋‚˜ ์ฐจ ์žˆ๋Š”์ง€(์˜ˆ: 100MB ์ค‘ 50MB ์‚ฌ์šฉ, 50%)์™€ ์ „์ฒด ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋Ÿ‰์„ ์•Œ๋ ค์ค๋‹ˆ๋‹ค.
  • ๋ฌธ์ œ๊ฐ€ ๋  ๋งŒํ•œ ์ด๋ฏธ์ง€๋ฅผ ์ฐพ์•„๋‚ด๊ณ  ์ ์ˆ˜(์˜ˆ: 65์ , C๋“ฑ๊ธ‰)์™€ ๊ฐœ์„  ์ œ์•ˆ์„ ์ค๋‹ˆ๋‹ค. (์˜ˆ: "์ด ์ด๋ฏธ์ง€๋Š” ํ™”๋ฉด ํฌ๊ธฐ๋ณด๋‹ค 4๋ฐฐ ํฝ๋‹ˆ๋‹ค" โ†’ ํฌ๊ธฐ๋ฅผ ์ค„์—ฌ ์“ฐ๋ผ๋Š” ์ œ์•ˆ)
  • ์Œ“์ธ ์บ์‹œ๋ฅผ ๋น„์›Œ์„œ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๋‹ค์‹œ ํ™•๋ณดํ•ด ์ค๋‹ˆ๋‹ค.

์–ด๋–ป๊ฒŒ ์“ฐ๋‚˜์š”#

# ์ง€๊ธˆ ์บ์‹œ ์ƒํƒœ ํ™•์ธ
/inspector/image stats

# ๋ฌธ์ œ ์žˆ๋Š” ์ด๋ฏธ์ง€ ๋ถ„์„
/inspector/image warnings

# ๋งŒ๋ฃŒ๋œ ์บ์‹œ ๋น„์šฐ๊ธฐ
/inspector/image clear expired

clear ๋’ค์—๋Š” ๋น„์šธ ๋Œ€์ƒ์„ ๊ณจ๋ผ ์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: all(์ „์ฒด) / memory(๋ฉ”๋ชจ๋ฆฌ) / disk(๋””์Šคํฌ) / expired(๋งŒ๋ฃŒ๋œ ๊ฒƒ).

์•ˆ์—์„œ ๋ฌด์Šจ ์ผ์ด ๋ฒŒ์–ด์ง€๋‚˜์š”#

์ƒํ™ฉ๋ณ„๋กœ ์•„๋ž˜ ์ˆœ์„œ๋Œ€๋กœ ์ ๊ฒ€ํ•ฉ๋‹ˆ๋‹ค.

  • ๋ฉ”๋ชจ๋ฆฌ ๊ฒฝ๊ณ ๊ฐ€ ๋–ด์„ ๋•Œ: ํ˜„์žฌ ์‚ฌ์šฉ๋Ÿ‰ ํ™•์ธ โ†’ ๋ฌธ์ œ ์ด๋ฏธ์ง€ ์ฐพ๊ธฐ โ†’ ์บ์‹œ ๋น„์šฐ๊ธฐ โ†’ ์ด๋ฏธ์ง€ ํฌ๊ธฐ ์ค„์ด๊ธฐ(cacheWidth/cacheHeight) ๊ฒ€ํ† 
  • ์ด๋ฏธ์ง€ ๋กœ๋”ฉ์ด ๋А๋ฆด ๋•Œ: ์บ์‹œ ์ ์ค‘๋ฅ  ํ™•์ธ โ†’ ๋„คํŠธ์›Œํฌ ๋‹ค์šด๋กœ๋“œ ์ ๊ฒ€ โ†’ ์ด๋ฏธ์ง€ ์šฉ๋Ÿ‰ ์ตœ์ ํ™” ๊ฒ€ํ† 
  • ์•ฑ์ด ๋ฉ”๋ชจ๋ฆฌ ์ดˆ๊ณผ๋กœ ๊บผ์งˆ ๋•Œ: ์ตœ๋Œ€ ๋ฉ”๋ชจ๋ฆฌ ํ™•์ธ โ†’ ๋„ˆ๋ฌด ํฐ ์ด๋ฏธ์ง€ ์ฐพ๊ธฐ โ†’ ํฐ ์ด๋ฏธ์ง€ ์ตœ์ ํ™” โ†’ ์ตœ๋Œ€ ์บ์‹œ ํฌ๊ธฐ ์กฐ์ • ๊ฒ€ํ† 

โš™๏ธ ์ƒ์„ธ ์˜ต์…˜ยท์‹คํ–‰ ๋ช…์„ธ (๊ฐœ๋ฐœ์ž / AI ์—์ด์ „ํŠธ์šฉ)

Triggers#

  • Image cache issues
  • Memory usage warnings
  • Image loading performance

MCP Tools#

img_get_cache_stats#

Returns image cache statistics.

Response example:

{
   " cache " : {
     " currentSize " : 52428800,
     " currentSizeFormatted " :  " 50 MB " ,
     " maximumSize " : 104857600,
     " maximumSizeFormatted " :  " 100 MB " ,
     " usagePercent " : 50,
     " liveImageCount " : 25
  },
   " memory " : {
     " currentUsage " : 157286400,
     " currentUsageFormatted " :  " 150 MB " 
   }
}

img_analyze_warnings#

Analyzes image-related warnings and issues.

Parameters:

  • threshold: Warning threshold (MB)

Response example:

{
   " warnings " : [
    {
       " type " :  " oversized " ,
       " severity " :  " high " ,
       " message " :  " Image is 4x larger than display size " ,
       " image " :  " banner_home.png " ,
       " suggestion " :  " Recommend using cacheWidth/cacheHeight " 
     }
  ],
   " score " : 65,
   " grade " :  " C " 
 }

img_clear_cache#

Clears the image cache.

Parameters:

  • type: Clear type (all, memory, disk, expired)

Common Diagnostics#

Memory warning#

1. img_get_cache_stats - >   Check current usage
2. img_analyze_warnings - >   Identify problematic images
3. img_clear_cache - >   Clear cache
4. Consider applying cacheWidth/cacheHeight

Slow image loading#

1. img_get_cache_stats - >   Check cache hit rate
2. /inspector/network - >   Check downloads
3. Review image size optimization

App crash (OOM)#

1. img_get_cache_stats - >   Check peak memory
2. img_analyze_warnings - >   Find oversized images
3. Apply large image optimization
4. Consider adjusting maximum cache size

Best Practices#

Image Loading Patterns#

// CORRECT: Specify cache size
Image.network(
  imageUrl,
  cacheWidth: 200,
  cacheHeight: 200,
)

// CORRECT: Use CachedNetworkImage
CachedNetworkImage(
  imageUrl: imageUrl,
  memCacheWidth: 200,
  placeholder: (context, url) => CircularProgressIndicator(),
)

// WRONG: Loading at original size
Image.network(imageUrl)  // 4000x4000 image displayed at 100x100

Examples#

Check cache status#

/inspector/image stats

Analyze image issues#

/inspector/image warnings

Clear cache#

/inspector/image clear expired

References#

  • Detailed implementation: .claude/agents/flutter-inspector-image.md
  • Master inspector: .claude/commands/inspector.md
  • Image optimization: .claude/agents/flutter-image-optimizer.md