Skip to main content
grey-hound432 avatar

Fast Image Resizer API

grey-hound432/fast-image-resizer

Resize an image to exact pixel dimensions or shrink it to fit inside a bounding box, returning a JPEG — a deterministic resize with no generative model involved.

preprocess
A4000,RTX4000
0.000358

Model Input

Input

URL of the image to resize. It must be a flat RGB image (JPEG, WebP, or an RGB PNG): a file carrying an alpha channel (RGBA) or a colour palette - which covers most PNG and GIF screenshots, icons and logos - fails the run outright: 'cannot write mode RGBA as JPEG' for an alpha channel, 'cannot write mode P as JPEG' for a palette. Flatten such an image onto a solid background and re-save it as RGB before sending.

Min: 1

Target width in pixels. With keep_aspect_ratio true (the default) this is the maximum width of the box the image is shrunk into, not the exact output width; with keep_aspect_ratio false it is the exact output width.

Min: 1

Target height in pixels. With keep_aspect_ratio true (the default) this is the maximum height of the box the image is shrunk into, not the exact output height; with keep_aspect_ratio false it is the exact output height.

Additional Settings

Customize your input with more control.

How width and height are applied. true (the default) fits the image inside the width x height box while keeping its proportions - an 800x600 photo into a 200x200 box comes back 200x150 - and NEVER enlarges: asking for a box larger than the source returns the source at its original size, merely re-encoded to JPEG, as a successful and billable run. false stretches the image to exactly width x height, changing its proportions whenever the target box has a different aspect ratio.

You need to be logged in to run this model and view results.
Log in

Model Output

Output

Fill in the input form and click submit to see the output
Logs (1 lines)

Model Example Requests

Examples

Example output 1Example output 2

Fast Image Resizer API

Fast Image Resizer is a image-to-image AI model by grey-hound432. On ModelRunner it runs through a REST API or via MCP from any AI assistant, at about $0.000358 per image.

POST https://queue.modelrunner.run/grey-hound432/fast-image-resizer

cURL

# Submit a request to the queue. Input fields go at the top level of the
# body. The optional reserved "metadata" object holds your own flat string
# tags — stored on the request, never sent to the model; filter later with
# GET https://queue.modelrunner.run/requests?metadata=<url-encoded JSON>.
curl -X POST https://queue.modelrunner.run/grey-hound432/fast-image-resizer \
  -H "Authorization: Key $MRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://example.com/input.jpg",
    "metadata": {
      "project": "my-project"
    }
  }'
# → { "request_id": "...", "status_url": "...", "response_url": "..." }

# Poll status_url until "COMPLETED", then fetch the result
curl "https://queue.modelrunner.run/grey-hound432/fast-image-resizer/requests/$REQUEST_ID/status" \
  -H "Authorization: Key $MRUN_API_KEY"
curl "https://queue.modelrunner.run/grey-hound432/fast-image-resizer/requests/$REQUEST_ID" \
  -H "Authorization: Key $MRUN_API_KEY"

JavaScript

import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("grey-hound432/fast-image-resizer", {
  input: {
    "image": "https://example.com/input.jpg"
  },
});
console.log(result);

Python

import os
import requests

headers = {"Authorization": f"Key {os.environ['MRUN_API_KEY']}"}

submitted = requests.post(
    "https://queue.modelrunner.run/grey-hound432/fast-image-resizer",
    headers=headers,
    json={
      "image": "https://example.com/input.jpg"
    },
).json()

# Poll submitted["status_url"] until "COMPLETED", then:
result = requests.get(submitted["response_url"], headers=headers).json()

Input parameters

Input parameters of Fast Image Resizer
NameTypeRequiredDescription
imagestring (uri)yesURL of the image to resize. It must be a flat RGB image (JPEG, WebP, or an RGB PNG): a file carrying an alpha channel (RGBA) or a colour palette - which covers most PNG and GIF screenshots, icons and logos - fails the run outright: 'cannot write mode RGBA as JPEG' for an alpha channel, 'cannot write mode P as JPEG' for a palette. Flatten such an image onto a solid background and re-save it as RGB before sending.
widthintegernoTarget width in pixels. With keep_aspect_ratio true (the default) this is the maximum width of the box the image is shrunk into, not the exact output width; with keep_aspect_ratio false it is the exact output width. Default: 512.
heightintegernoTarget height in pixels. With keep_aspect_ratio true (the default) this is the maximum height of the box the image is shrunk into, not the exact output height; with keep_aspect_ratio false it is the exact output height. Default: 512.
keep_aspect_ratiobooleannoHow width and height are applied. true (the default) fits the image inside the width x height box while keeping its proportions - an 800x600 photo into a 200x200 box comes back 200x150 - and NEVER enlarges: asking for a box larger than the source returns the source at its original size, merely re-encoded to JPEG, as a successful and billable run. false stretches the image to exactly width x height, changing its proportions whenever the target box has a different aspect ratio. Default: true.

Machine-readable: OpenAPI schema · llms.txt

Use Fast Image Resizer from Claude & Cursor (MCP)

Point Claude Code, Claude Desktop, Cursor, or any MCP client at the ModelRunner MCP server and Fast Image Resizer becomes a tool your assistant can call directly — it authorizes via OAuth (no API key in config) and runs this model with the run_model tool using the endpoint grey-hound432/fast-image-resizer.

MCP client config (Claude Desktop, Cursor)

{
  "mcpServers": {
    "modelrunner": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.modelrunner.run/mcp"]
    }
  }
}

Claude Code

claude mcp add --transport http modelrunner https://mcp.modelrunner.run/mcp

Then ask your assistant, for example: “Run grey-hound432/fast-image-resizer on ModelRunner to generate image”. MCP setup guide.

Model Details

Model Details

Fast Image Resizer scales an image to a size you specify and returns a JPEG — whatever format you sent in. It is a plain, deterministic resize — Pillow resampling, no generative model and no invented detail — so the same input always gives the same result. With `keep_aspect_ratio` at its default `true` the image is shrunk to fit inside the `width` × `height` box with its proportions intact — an 800×600 photo into a 200×200 box gives 200×150 — and with `keep_aspect_ratio: false` it is stretched to exactly `width` × `height`, even when that changes its shape. Typical jobs are thumbnails, web assets, and normalising a folder of images to one size before another model sees them.

## Best for - Making thumbnails from large photos at a fixed maximum size - Producing an image at exact pixel dimensions when a layout or spec demands them - Shrinking oversized uploads before you store or serve them - Normalising an image dataset to one consistent size before training or batch inference - Preparing web and app assets where every image must fit the same box

## Choose another model when - You need the image to come out bigger than it went in. On the default path it never enlarges — ask for 2048×2048 from an 800×600 source and you get 800×600 back, unchanged and still billed. `keep_aspect_ratio: false` fills the box by stretching, not by adding detail, so use an upscaling model for real enlargement. - Your input carries transparency or a colour palette. Such PNG and GIF files fail the run outright with `cannot write mode RGBA as JPEG` or `cannot write mode P as JPEG` — flatten onto a solid background, or pick a model that writes PNG. - You want a crop-to-fill that covers the box edge to edge — this model only fits inside the box or stretches to it, so use a cropping or image-editing model.

## Tips - On the default path treat `width` and `height` as a bounding box, not as the output size: the result is the largest fit inside them, and never larger than the source. - Set `keep_aspect_ratio: false` only when the exact output dimensions matter more than the proportions.

## Limitations - JPEG quality is fixed — there is no compression or quality control. - No cropping, padding, rotation, or output-format choice.

To run via the ModelRunner JavaScript client: ```js import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("grey-hound432/fast-image-resizer", { input: { image: "https://media.modelrunner.ai/YfJkKwD17pagVEM6QNAeq.webp", width: 320, height: 320, }, }); ```