image dimensions.com
image dimensions.com logo

Image Dimensions

Retrieves image dimensions from URLs and local files with optional compression capabilities through the Tinify API for i...

Created byApr 23, 2025

Image Tools MCP

A Model Context Protocol (MCP) service for retrieving image dimensions and compressing images, supporting both URL and local file sources.
_[ ](./README_zh.md)_

Features

  • Retrieve image dimensions from URLs
  • Get image dimensions from local files
  • Compress images from URLs using TinyPNG API
  • Compress local images using TinyPNG API
  • Convert images to different formats (webp, jpeg/jpg, png)
  • Returns width, height, type, MIME type, and compression information

Example Results

![Example Result 1](./public/image_1.png) ![Example Result 2](./public/image_2.png)
download from figma url and compress ![Example Result 3](./public/image_figma_url.png)

Usage

Using as an MCP Service

This service provides five tool functions:
  1. `get_image_size` - Get dimensions of remote images
  1. `get_local_image_size` - Get dimensions of local images
  1. `compress_image_from_url` - Compress remote images using TinyPNG API
  1. `compress_local_image` - Compress local images using TinyPNG API
  1. `figma` - Fetch image links from Figma API and compress them using TinyPNG API

Client Integration

To use this MCP service, you need to connect to it from an MCP client. Here are examples of how to integrate with different clients:

Using with Claude Desktop

  1. Install Claude Desktop from [claude.ai/download](https://claude.ai/download)
  1. Get TinyPNG API key: Visit [TinyPNG](https://tinypng.com/developers) and get your API key
  1. Configure Claude Desktop to use this MCP server by editing the configuration file:
  1. Restart Claude Desktop
  1. Ask Claude to get image dimensions: "Can you tell me the dimensions of this image: https://example.com/image.jpg"
  1. Ask Claude to compress an image: "Can you compress this image: https://example.com/image.jpg"
  1. Ask Claude to compress a local image: "Can you compress this image: D:/path/to/image.png"
  1. Ask Claude to compress a local image folder: "Can you compress this folder: D:/imageFolder"
  1. Ask Claude to fetch image links from Figma API: "Can you fetch image links from Figma API: https://www.figma.com/file/XXXXXXX"

Using with MCP Client Library

get_local_image_size

compress_image_from_url

compress_local_image

figma

Technical Implementation

This project is built on the following libraries:
  • [probe-image-size](https://github.com/nodeca/probe-image-size) - For image dimension detection
  • [tinify](https://github.com/tinify/tinify-nodejs) - For image compression via the TinyPNG API
  • [figma-api](https://github.com/figma/api) - For fetching image links from Figma API

Environment Variables

  • `TINIFY_API_KEY` - Required for image compression functionality. Get your API key from [TinyPNG](https://tinypng.com/developers) - When not provided, the compression tools (`compress_image_from_url` and `compress_local_image`) will not be registered
  • `FIGMA_API_TOKEN` - Required for fetching image links from Figma API. Get your API token from [Figma](https://www.figma.com/developers) - When not provided, the Figma tool (`figma`) will not be registered
Note: The basic image dimension tools (`get_image_size` and `get_local_image_size`) are always available regardless of API keys.

License

MIT