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

# GIF Generation

> Create animated GIFs from HTML animations or URL captures

# GIF Generation

Generate animated GIFs from HTML with CSS animations or by recording live web pages.

## Endpoints

| Method | Endpoint       | Description                                                                      |
| ------ | -------------- | -------------------------------------------------------------------------------- |
| `POST` | `/gif`         | [Create GIF](/api-reference/endpoints/gifs/create) from HTML with CSS animations |
| `GET`  | `/gif`         | [List GIFs](/api-reference/endpoints/gifs/list)                                  |
| `GET`  | `/gif/{uid}`   | [Get GIF](/api-reference/endpoints/gifs/get)                                     |
| `POST` | `/gif/capture` | [Capture GIF](/api-reference/endpoints/gifs/capture) from a live URL             |

## Quality Presets

| Preset   | Frame Rate | Max Duration | Best For                            |
| -------- | ---------- | ------------ | ----------------------------------- |
| `low`    | 10 fps     | 10 seconds   | Small file size, simple animations  |
| `medium` | 15 fps     | 15 seconds   | Balanced quality and size           |
| `high`   | 24 fps     | 30 seconds   | Smooth animations, detailed content |

<Note>
  The response is wrapped in a `gif` object. Higher quality settings produce larger files.
</Note>

## Key Parameters

| Parameter              | Type    | Default  | Description                                                 |
| ---------------------- | ------- | -------- | ----------------------------------------------------------- |
| `width`                | integer | -        | Output width (1-2000, required)                             |
| `height`               | integer | -        | Output height (1-2000, required)                            |
| `quality`              | string  | `medium` | Quality preset                                              |
| `frameDurationSeconds` | number  | -        | Animation duration to capture                               |
| `selector`             | string  | -        | CSS selector to capture specific element (URL capture only) |
| `waitForSelector`      | string  | -        | Wait for element before recording (URL capture only)        |

## Tips for Better GIFs

1. **Keep dimensions reasonable** -- smaller GIFs load faster and compress better
2. **Optimize animations** -- simple, smooth animations compress better than complex ones
3. **Use solid backgrounds** -- gradients and transparency increase file size
4. **Limit colors** -- GIFs are limited to 256 colors per frame
5. **Loop seamlessly** -- design animations to loop smoothly for better visual appeal


## OpenAPI

````yaml post /gif
openapi: 3.1.0
info:
  title: Pictify API
  version: 1.0.0
  description: |
    Generate images, GIFs, and PDFs from HTML templates programmatically.

    ## Authentication
    All API requests require a Bearer token in the Authorization header:
    ```
    Authorization: Bearer pk_live_your_api_key
    ```

    ## Rate Limits
    - Free: 60 requests/minute
    - Pro: 300 requests/minute
    - Business: 1,000 requests/minute

    Rate limit headers are included in all responses.
  contact:
    email: support@pictify.io
    url: https://pictify.io
  license:
    name: MIT
servers:
  - url: https://api.pictify.io
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Images
    description: Image generation endpoints
  - name: GIFs
    description: GIF generation and capture
  - name: PDFs
    description: PDF generation
  - name: Templates
    description: Template management
  - name: Batch
    description: Batch rendering operations
  - name: Experiments
    description: A/B testing, smart links, and scheduled variant experiments
  - name: Webhooks
    description: Webhook subscription management
  - name: Bindings
    description: Data binding for auto-rendering
paths:
  /gif:
    post:
      tags:
        - GIFs
      summary: Generate a GIF
      description: Generate an animated GIF from HTML with CSS animations
      operationId: createGif
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GifRequest'
      responses:
        '200':
          description: GIF generated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GifResponse'
components:
  schemas:
    GifRequest:
      type: object
      properties:
        html:
          type: string
          description: HTML content with CSS animations
        url:
          type: string
          format: uri
          description: URL to capture
        template:
          type: string
          description: Template UID
        variables:
          type: object
          additionalProperties: true
        width:
          type: integer
          minimum: 1
          maximum: 2000
          default: 800
        height:
          type: integer
          minimum: 1
          maximum: 2000
          default: 600
    GifResponse:
      type: object
      properties:
        gif:
          type: object
          properties:
            url:
              type: string
              format: uri
            uid:
              type: string
            width:
              type: integer
            height:
              type: integer
            animationLength:
              type: number
              description: Animation duration in seconds
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key obtained from the Pictify dashboard

````