# Tinify

> Compress and convert PNG, JPEG, WebP, and AVIF images with Tinify (TinyPNG / TinyJPG) to shrink file sizes without losing quality.

App · Images & Design · 2 actions. Web page: https://docs.lodol.com/docs/integrations/tinify

## Actions

### Compress Image

Shrink a PNG, JPEG, or WebP image's file size with Tinify (TinyPNG) while keeping it looking the same. The compressed image is saved so later steps can email, upload, or store it.

**Inputs**

- Image (`image`, text, required): The image to compress: upload one, pick a file from an earlier step, or paste a public image URL.
- Save as (`filename`, text): Optional. The name to save the compressed image under. Defaults to the original name.

**Outputs**

- `compressed_size_bytes` (number): Size of the compressed image in bytes
- `content_type` (text): MIME type of the saved image
- `document_ref` (text): Reference to the compressed image, for use by a later step
- `documents` (list): The compressed image, in the shape steps that send or upload files expect
- `filename` (text): Name the image was saved under
- `height` (number): Height of the compressed image in pixels
- `original_size_bytes` (number): Size of the original image in bytes
- `size_bytes` (number): Size of the saved image in bytes
- `url` (text): Download URL for the compressed image
- `width` (number): Width of the compressed image in pixels

**Example output**

```json
{
  "compressed_size_bytes": 40213,
  "content_type": "image/png",
  "document_ref": "doc_5c6d7e8f90a1b2c35c6d7e8f90a1b2c3",
  "documents": [
    {
      "content_type": "image/png",
      "document_ref": "doc_5c6d7e8f90a1b2c35c6d7e8f90a1b2c3",
      "filename": "compressed.png",
      "size_bytes": 40213,
      "url": "/actions/core/serve-document/doc_5c6d7e8f90a1b2c35c6d7e8f90a1b2c3?teamId=6512a1b2c3d4e5f600000001"
    }
  ],
  "filename": "compressed.png",
  "height": 512,
  "original_size_bytes": 102400,
  "size_bytes": 40213,
  "url": "/actions/core/serve-document/doc_5c6d7e8f90a1b2c35c6d7e8f90a1b2c3?teamId=6512a1b2c3d4e5f600000001",
  "width": 512
}
```

### Convert Image

Convert an image to another format (WebP, JPEG, PNG, or AVIF) with Tinify, compressing it at the same time. The converted image is saved so later steps can email, upload, or store it.

**Inputs**

- Image (`image`, text, required): The image to compress: upload one, pick a file from an earlier step, or paste a public image URL.
- Convert to (`format`, text, required): The image format to convert to. One of: `image/webp` (WebP), `image/jpeg` (JPEG), `image/png` (PNG), `image/avif` (AVIF). Default: `image/webp`.
- Background color (`background`, text): Optional. A background color (like `#FFFFFF`, `white`, or `black`) to fill transparency when converting to JPEG, which has no transparency.
- Save as (`filename`, text): Optional. The name to save the converted image under. Defaults to the original name.

**Outputs**

- `content_type` (text): MIME type of the saved image
- `document_ref` (text): Reference to the converted image, for use by a later step
- `documents` (list): The converted image, in the shape steps that send or upload files expect
- `filename` (text): Name the image was saved under
- `format` (text): The MIME type the image was converted to
- `height` (number): Height of the converted image in pixels
- `size_bytes` (number): Size of the saved image in bytes
- `url` (text): Download URL for the converted image
- `width` (number): Width of the converted image in pixels

**Example output**

```json
{
  "content_type": "image/webp",
  "document_ref": "doc_6d7e8f90a1b2c3d46d7e8f90a1b2c3d4",
  "documents": [
    {
      "content_type": "image/webp",
      "document_ref": "doc_6d7e8f90a1b2c3d46d7e8f90a1b2c3d4",
      "filename": "converted.webp",
      "size_bytes": 28104,
      "url": "/actions/core/serve-document/doc_6d7e8f90a1b2c3d46d7e8f90a1b2c3d4?teamId=6512a1b2c3d4e5f600000001"
    }
  ],
  "filename": "converted.webp",
  "format": "image/webp",
  "height": 512,
  "size_bytes": 28104,
  "url": "/actions/core/serve-document/doc_6d7e8f90a1b2c3d46d7e8f90a1b2c3d4?teamId=6512a1b2c3d4e5f600000001",
  "width": 512
}
```
