agentsclimarketplace

Image storage embedding split

Skill fabioc-aloha/Alex_Skill_Mall/plugins/media-graphics/image-storage-embedding-split

Storing images at embed size loses the original:From its SKILL.md

Install
npx -y skills add fabioc-aloha/Alex_Skill_Mall --skill image-storage-embedding-split

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

2.0 KB, 459 tokens by cl100k_base, as published. Nobody here has run it

Image Storage vs Embedding Split

The Problem

Storing images at embed size loses the original:

  • Can't upscale later
  • Can't use for different contexts
  • Quality degradation is permanent

The Solution

Keep originals at full resolution. Embed at reduced size.

const sharp = require('sharp');

async function processImage(inputPath, outputDir) {
  const filename = path.basename(inputPath, path.extname(inputPath));
  
  // Store original at full resolution
  const original = await sharp(inputPath)
    .resize(512, 512, { fit: 'inside' })
    .toFile(path.join(outputDir, `${filename}-512.png`));
  
  // Create embed version at reduced size
  const embed = await sharp(inputPath)
    .resize(256, 256, { fit: 'inside' })
    .toBuffer();
  
  // Return both
  return {
    originalPath: path.join(outputDir, `${filename}-512.png`),
    embedDataUri: `data:image/png;base64,${embed.toString('base64')}`,
    embedSize: 256
  };
}

Storage Schema

{
  "images": [
    {
      "id": "avatar-001",
      "originalPath": "assets/avatar-001-512.png",
      "embedDataUri": "data:image/png;base64,iVBOR...",
      "embedSize": 256,
      "originalSize": 512
    }
  ]
}

Token Savings

SizeBase64 SizeToken Estimate
512px~42KB~10,500 tokens
256px~13KB~3,250 tokens
Savings~70%~7,250 tokens

Verification

  1. Original file exists at full resolution
  2. Embedded version is at reduced size
  3. Schema documents both dimensions
  4. Can regenerate embed from original

When to Apply

  • AI context windows with images
  • Visual memory systems
  • Any system with storage/display size trade-offs

Tags

images ai tokens storage

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.