---
title: "Rotate character or object"
method: POST
path: "/rotate"
tags: ["Rotate"]
---

# Rotate character or object

`POST /rotate`

Rotates a pixel art image based on the provided parameters. Called "Rotate" in the plugin.

Supported image sizes: 
- 16x16
- 32x32
- 64x64
- 128x128    

Supported features:
- Init image
- Forced palette

Using the Python client:
```python
import pixellab

client = pixellab.Client(secret="YOUR_API_TOKEN")

response = client.rotate(
    from_view="side",
    to_view="side",
    from_direction="south",
    to_direction="east",
    image_size=dict(width=16, height=16),
    from_image=image_of_subject_facing_south,
)
response.image.pil_image()
```

## Request body

- RotateRequest — Request model for image generation endpoint
  - `image_size` AppEndpointsExternalV1GenerateRotationImageSize, required
    - `width` integer, required — Image width in pixels
    - `height` integer, required — Image height in pixels
  - `image_guidance_scale` number — How closely to follow the reference image
  - `view_change` integer, nullable — How many degrees to tilt the subject
  - `direction_change` integer, nullable — How many degrees to rotate the subject
  - `from_view` 'side' | 'low top-down' | 'high top-down'
  - `to_view` 'side' | 'low top-down' | 'high top-down'
  - `from_direction` 'north' | 'north-east' | 'east' | 'south-east' | 'south' | 'south-west' | 'west' | 'north-west'
  - `to_direction` 'north' | 'north-east' | 'east' | 'south-east' | 'south' | 'south-west' | 'west' | 'north-west'
  - `isometric` boolean — Generate in isometric view
  - `oblique_projection` boolean — Generate in oblique projection
  - `init_image` Base64Image — A base64 encoded image. Attributes: type (Literal["base64"]): Always "base64" to indicate the image encoding type base64 (str): The base64 encoded image data
    - `type` 'base64' — Image data type
    - `base64` string, required — Base64 encoded image data
  - `init_image_strength` integer — Strength of the initial image influence
  - `mask_image` Base64Image — A base64 encoded image. Attributes: type (Literal["base64"]): Always "base64" to indicate the image encoding type base64 (str): The base64 encoded image data
    - `type` 'base64' — Image data type
    - `base64` string, required — Base64 encoded image data
  - `from_image` Base64Image, required — A base64 encoded image. Attributes: type (Literal["base64"]): Always "base64" to indicate the image encoding type base64 (str): The base64 encoded image data
    - `type` 'base64' — Image data type
    - `base64` string, required — Base64 encoded image data
  - `color_image` Base64Image — A base64 encoded image. Attributes: type (Literal["base64"]): Always "base64" to indicate the image encoding type base64 (str): The base64 encoded image data
    - `type` 'base64' — Image data type
    - `base64` string, required — Base64 encoded image data
  - `seed` integer, nullable — Seed decides the starting noise

## Response `200`

Successfully generated image

- RotateResponse
  - `usage` Usage, required
    - `type` 'usd' | 'generations'
    - `usd` number, nullable
    - `generations` number, nullable
  - `image` Base64Image, required — A base64 encoded image. Attributes: type (Literal["base64"]): Always "base64" to indicate the image encoding type base64 (str): The base64 encoded image data
    - `type` 'base64' — Image data type
    - `base64` string, required — Base64 encoded image data

## Other responses

- `401` — Invalid API token
- `402` — Insufficient credits
- `422` — Validation error
- `429` — Too many requests
- `529` — Rate limit exceeded

---

[API](https://skmtc.dev/pixellab/apis/pixel-lab-api.md) · [All operations](https://skmtc.dev/pixellab/apis/pixel-lab-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/pixellab/pixel-lab-api/revisions/eb7a18b195ba/schema)
