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

# tinify

> Image Compression API

**Server path:** `/tinify` | **Type:** Application | **PCID required:** Yes

## Tools

| Tool                                                | Description                  |
| --------------------------------------------------- | ---------------------------- |
| [`tinify_compress_image`](#tinify_compress_image)   | Compress an image            |
| [`tinify_transform_image`](#tinify_transform_image) | Transform a compressed image |

***

## tinify\_compress\_image

Compress an image

**Parameters:**

| Parameter | Type   | Required | Default | Description      |
| --------- | ------ | -------- | ------- | ---------------- |
| `source`  | object | Yes      | —       | The source value |

<Expandable title="inputSchema">
  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "PCID": {
        "type": "string",
        "description": "Pink Connect ID for the authenticated connection"
      },
      "source": {
        "type": "object",
        "description": "The source value",
        "properties": {
          "url": {
            "type": "string",
            "description": "URL of the image to compress. Must be publicly accessible."
          }
        },
        "required": [
          "url"
        ]
      }
    },
    "required": [
      "PCID",
      "source"
    ]
  }
  ```
</Expandable>

***

## tinify\_transform\_image

Transform a compressed image

**Parameters:**

| Parameter      | Type      | Required | Default | Description                                                                                                                                                                                 |
| -------------- | --------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `output_token` | string    | Yes      | —       | The output token from a previous compression. This is the path segment from the Location header or output.url returned by the compress endpoint (e.g., the part after /output/ in the URL). |
| `convert`      | object    | No       | —       | Convert the image to a different format.                                                                                                                                                    |
| `preserve`     | string\[] | No       | —       | Metadata to preserve from the original image.                                                                                                                                               |
| `resize`       | object    | No       | —       | Resize the image. Requires at least a method and one dimension.                                                                                                                             |
| `store`        | object    | No       | —       | Store the result directly to a cloud storage service instead of returning it.                                                                                                               |
| `transform`    | object    | No       | —       | Apply transformations. Currently only supports setting a background color for transparent-to-JPEG conversions.                                                                              |

<Expandable title="inputSchema">
  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "PCID": {
        "type": "string",
        "description": "Pink Connect ID for the authenticated connection"
      },
      "output_token": {
        "type": "string",
        "description": "The output token from a previous compression. This is the path segment from the Location header or output.url returned by the compress endpoint (e.g., the part after /output/ in the URL)."
      },
      "convert": {
        "type": "object",
        "description": "Convert the image to a different format.",
        "properties": {
          "type": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "image/webp",
                "image/jpeg",
                "image/png",
                "image/avif"
              ]
            },
            "description": "Target format MIME type. Use '*/*' or an array of types to let Tinify pick the smallest. Supported: image/webp, image/jpeg, image/png, image/avif."
          }
        }
      },
      "preserve": {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "copyright",
            "creation",
            "location"
          ]
        },
        "description": "Metadata to preserve from the original image."
      },
      "resize": {
        "type": "object",
        "description": "Resize the image. Requires at least a method and one dimension.",
        "properties": {
          "method": {
            "type": "string",
            "description": "Resize method. 'scale' scales proportionally (provide width OR height). 'fit' scales to fit within dimensions. 'cover' scales and crops to exact dimensions. 'thumb' is like cover but uses smart cropping.",
            "enum": [
              "scale",
              "fit",
              "cover",
              "thumb"
            ]
          },
          "width": {
            "type": "integer",
            "description": "Target width in pixels"
          },
          "height": {
            "type": "integer",
            "description": "Target height in pixels"
          }
        }
      },
      "store": {
        "type": "object",
        "description": "Store the result directly to a cloud storage service instead of returning it.",
        "properties": {
          "service": {
            "type": "string",
            "description": "Cloud storage service: 's3' for Amazon S3, 'gcs' for Google Cloud Storage",
            "enum": [
              "s3",
              "gcs"
            ]
          },
          "path": {
            "type": "string",
            "description": "Storage path including bucket name (e.g., 'my-bucket/images/photo.jpg')"
          },
          "aws_access_key_id": {
            "type": "string",
            "description": "AWS access key ID (required for S3)"
          },
          "aws_secret_access_key": {
            "type": "string",
            "description": "AWS secret access key (required for S3)"
          },
          "region": {
            "type": "string",
            "description": "AWS region (required for S3, e.g., 'us-west-1')"
          },
          "gcp_access_token": {
            "type": "string",
            "description": "GCP OAuth access token (required for GCS)"
          },
          "headers": {
            "type": "object",
            "description": "Additional headers to set on the stored object (e.g., Cache-Control)"
          },
          "acl": {
            "type": "string",
            "description": "Access control for S3 objects. Use 'no-acl' to use the bucket's default ACL.",
            "enum": [
              "public-read",
              "no-acl"
            ]
          }
        },
        "required": [
          "service",
          "path"
        ]
      },
      "transform": {
        "type": "object",
        "description": "Apply transformations. Currently only supports setting a background color for transparent-to-JPEG conversions.",
        "properties": {
          "background": {
            "type": "string",
            "description": "Background color as hex (#000000) or name (white, black). Required when converting transparent images to JPEG."
          }
        }
      }
    },
    "required": [
      "PCID",
      "output_token"
    ]
  }
  ```
</Expandable>
