82trust / 100

Image Dominant Color

by Image dominant color in Search & web

x402 APIPassing, checked 2 h ago

Extract the dominant colors of an image as a palette of hex values with pixel ratios. Send a public image URL or a base64 image, and optionally how many colors (1-10, default 5). Deterministic bucketed quantization; transparent pixels are ignored.

POST https://agent402.tools/api/image-dominant-color

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
227 ms typical, 227 ms slowest 5%
Last check
2 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://agent402.tools/api/image-dominant-color" \
  -H "content-type: application/json" \
  -d '{"colors":3,"url":"https://agent402.tools/fixtures/sample-photo.jpg"}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagent402.tools%2Fapi%2Fimage-dominant-color
const res = await pay("https://agent402.tools/api/image-dominant-color", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"colors":3,"url":"https://agent402.tools/fixtures/sample-photo.jpg"}),
});
console.log(await res.json());

Example input

{
  "colors": 3,
  "url": "https://agent402.tools/fixtures/sample-photo.jpg"
}

Example output

{
  "colors": [
    {
      "hex": "#1f7a8b",
      "ratio": 0.5938,
      "rgb": [
        31,
        122,
        139
      ]
    },
    {
      "hex": "#df7a1e",
      "ratio": 0.2813,
      "rgb": [
        223,
        122,
        30
      ]
    },
    {
      "hex": "#22223a",
      "ratio": 0.0938,
      "rgb": [
        34,
        34,
        58
      ]
    }
  ],
  "height": 80,
  "sampled": 6144,
  "width": 120
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
2 h agoPassed402236 ms$0.003
7 h agoPassed402227 ms$0.003