obfus.link

Image to Base64 encodes images in four formats: data-uri, raw base64, CSS url(), and LLM vision message blocks for Claude, GPT-4V, and Gemini. Auto-resizes to provider-optimal dimensions, converts WebP, AVIF, and HEIF to PNG or JPEG before encoding, strips EXIF metadata, and supports batch mode for multi-image vision payloads in a single call.

Tier 3encoders✓ TDD Verified

Image to Base64

Encode images for LLM vision APIs with resize and format conversion

How to use

  1. Provide the imagePaste a data URL or upload the image file. The tool auto-detects mimeType.
  2. Choose output formatdata-uri for HTML embedding, raw for raw base64, css-url for background-image, llm-vision for vision API blocks.
  3. Select LLM provider (vision format only)Choose claude, gpt4v, or gemini. Auto-resize uses the provider-optimal dimension if maxDimension is omitted.
  4. Set processing optionsEnable optimize to strip EXIF and quantize PNG. Set convertTo to force PNG or JPEG output. Set maxDimension to override auto-resize.
  5. Encode and copyFor batch mode, an array of provider message blocks is returned ready to drop into a multi-image vision request.
Read technical article

MCP / API

Call image_to_base64 directly from any MCP-compatible agent:

// MCP TypeScript SDK
const result = await client.callTool({
  name: "image_to_base64",
  arguments: {
    "format": "data-uri"
  }
});

// curl
curl -X POST https://obfus.link/mcp \
  -H "Authorization: Bearer <SPT>" \
  -H "Content-Type: application/json" \
  -d '{"method":"tools/call","params":{"name":"image_to_base64","arguments":{"format":"data-uri"}}}'

Related tools

Base64 Codec
Encode, decode, and identify base64 with auto-detection
LLM to JSON Cleaner
Repair malformed JSON from LLM responses with confidence scoring
JWT Hardener
Audit and harden JWT tokens with security scoring and diff output

FAQ

Which image formats are supported as input?

PNG, JPEG, WebP, AVIF, HEIF, BMP, and TIFF are all accepted. Vision APIs only accept PNG and JPEG, so set convertTo to force the conversion before encoding. The full pipeline of convert, resize, optimize, encode, and format runs in a single tool call.

What does the llm-vision format output look like?

For Claude: { type: "image", source: { type: "base64", media_type, data } }. For GPT-4V: an OpenAI vision content block with image_url. For Gemini: an inlineData part. Each format is exactly what the provider expects — drop it into the messages array without modification.

How does intelligent resize work?

When llmTarget is set and maxDimension is omitted, the longest side resizes to the optimal dimension for that provider: 1568px for Claude, 2048px for GPT-4V, 3072px for Gemini. Aspect ratio is preserved. If maxDimension is explicitly set, it overrides the provider default.

Is there a file size limit?

The tool accepts images up to ~5MB raw. For batch mode, the total payload across all images should stay under the vision API request size limit (typically 20MB). Use the optimize flag and an aggressive maxDimension to keep batch payloads small.

Can I use this tool via the MCP API?

Yes. The tool is registered on the obfus.link MCP server at https://obfus.link/mcp. Call it from any MCP-compatible agent with a Shared Payment Token. The MCP tool name matches the snake_case slug shown in the integration snippet.