> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spojit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Image Tools

> Resize, crop, rotate, convert, compress, and transform images.

The Image Tools connector provides operations for image processing: resizing, cropping, format conversion, compression, and effects.

<Note>No connection required; this utility connector works out of the box.</Note>

All image inputs and outputs are **base64-encoded** strings.

## Tools

<AccordionGroup>
  <Accordion title="resize: Resize image">
    <ParamField body="image" type="string" required>
      Base64-encoded image.
    </ParamField>

    <ParamField body="width" type="number">
      Target width in pixels.
    </ParamField>

    <ParamField body="height" type="number">
      Target height in pixels.
    </ParamField>

    <ParamField body="fit" type="string" default="inside">
      Resize strategy: `cover`, `contain`, `fill`, `inside`, or `outside`.
    </ParamField>

    <ParamField body="format" type="string">
      Output format: `jpeg`, `png`, `webp`, or `avif`.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "image": "iVBORw0KGgoAAAANSUhEUgAABLA...",
      "width": 800,
      "height": 600,
      "fit": "inside",
      "format": "webp"
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "width": 800,
      "height": 533,
      "format": "webp",
      "image": "UklGRuoCAABXRUJQVlA4IN4CAABwEQ..."
    }
    ```
  </Accordion>

  <Accordion title="crop: Crop region">
    <ParamField body="image" type="string" required>
      Base64-encoded image.
    </ParamField>

    <ParamField body="left" type="number" required>
      Left edge position (x).
    </ParamField>

    <ParamField body="top" type="number" required>
      Top edge position (y).
    </ParamField>

    <ParamField body="width" type="number" required>
      Crop width.
    </ParamField>

    <ParamField body="height" type="number" required>
      Crop height.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "image": "iVBORw0KGgoAAAANSUhEUgAABLA...",
      "left": 100,
      "top": 50,
      "width": 400,
      "height": 300
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "width": 400,
      "height": 300,
      "image": "iVBORw0KGgoAAAANSUhEUgAAAZA..."
    }
    ```
  </Accordion>

  <Accordion title="rotate: Rotate image">
    <ParamField body="image" type="string" required>
      Base64-encoded image.
    </ParamField>

    <ParamField body="angle" type="number" required>
      Rotation angle in degrees (clockwise).
    </ParamField>

    <ParamField body="background" type="string" default="#000000">
      Background colour for exposed areas (hex).
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "image": "iVBORw0KGgoAAAANSUhEUgAABLA...",
      "angle": 90,
      "background": "#ffffff"
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "width": 600,
      "height": 1200,
      "image": "iVBORw0KGgoAAAANSUhEUgAAAloA..."
    }
    ```
  </Accordion>

  <Accordion title="convert: Convert format">
    <ParamField body="image" type="string" required>
      Base64-encoded image.
    </ParamField>

    <ParamField body="format" type="string" required>
      Target format: `jpeg`, `png`, `webp`, `avif`, `gif`, or `tiff`.
    </ParamField>

    <ParamField body="quality" type="number" default="80">
      Quality for lossy formats (1–100).
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "image": "iVBORw0KGgoAAAANSUhEUgAABLA...",
      "format": "webp",
      "quality": 85
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "format": "webp",
      "size": 45320,
      "image": "UklGRuoCAABXRUJQVlA4IN4CAABwEQ..."
    }
    ```
  </Accordion>

  <Accordion title="compress: Compress image">
    <ParamField body="image" type="string" required>
      Base64-encoded image.
    </ParamField>

    <ParamField body="quality" type="number" default="80">
      Quality level (1–100).
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "image": "iVBORw0KGgoAAAANSUhEUgAABLA...",
      "quality": 60
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "originalSize": 284500,
      "compressedSize": 98200,
      "reduction": "65%",
      "image": "/9j/4AAQSkZJRgABAQEASABIAAD..."
    }
    ```
  </Accordion>

  <Accordion title="get-info: Get image metadata">
    Returns dimensions, format, file size, and other metadata.

    <ParamField body="image" type="string" required>
      Base64-encoded image.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "image": "iVBORw0KGgoAAAANSUhEUgAABLA..."
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "width": 1920,
      "height": 1080,
      "format": "png",
      "space": "srgb",
      "channels": 4,
      "depth": "uchar",
      "density": 72,
      "hasAlpha": true,
      "orientation": 1,
      "size": 284500
    }
    ```
  </Accordion>

  <Accordion title="thumbnail: Generate thumbnail">
    <ParamField body="image" type="string" required>
      Base64-encoded image.
    </ParamField>

    <ParamField body="size" type="number" default="150">
      Maximum dimension in pixels.
    </ParamField>

    <ParamField body="format" type="string" default="jpeg">
      Output format: `jpeg`, `png`, or `webp`.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "image": "iVBORw0KGgoAAAANSUhEUgAABLA...",
      "size": 200,
      "format": "jpeg"
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "width": 200,
      "height": 133,
      "format": "jpeg",
      "image": "/9j/4AAQSkZJRgABAQEASABIAAD..."
    }
    ```
  </Accordion>

  <Accordion title="grayscale: Convert to grayscale">
    <ParamField body="image" type="string" required>
      Base64-encoded image.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "image": "iVBORw0KGgoAAAANSUhEUgAABLA..."
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "image": "iVBORw0KGgoAAAANSUhEUgAABLA..."
    }
    ```
  </Accordion>

  <Accordion title="flip: Flip image">
    <ParamField body="image" type="string" required>
      Base64-encoded image.
    </ParamField>

    <ParamField body="direction" type="string" required>
      Flip direction: `horizontal`, `vertical`, or `both`.
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "image": "iVBORw0KGgoAAAANSUhEUgAABLA...",
      "direction": "horizontal"
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "image": "iVBORw0KGgoAAAANSUhEUgAABLA..."
    }
    ```
  </Accordion>

  <Accordion title="blur: Apply blur effect">
    <ParamField body="image" type="string" required>
      Base64-encoded image.
    </ParamField>

    <ParamField body="sigma" type="number" default="3">
      Blur amount (0.3–1000).
    </ParamField>

    **Example request:**

    ```json theme={null}
    {
      "image": "iVBORw0KGgoAAAANSUhEUgAABLA...",
      "sigma": 5
    }
    ```

    **Example response:**

    ```json theme={null}
    {
      "success": true,
      "image": "iVBORw0KGgoAAAANSUhEUgAABLA..."
    }
    ```
  </Accordion>
</AccordionGroup>
