Rotate Image
Image → Rotate Image
The Rotate Image API rotates an image by a given angle. You send the image as Base64 (docContent), docName, RotationAngle (0-360 degrees), and optionally Backgroundcolor (hex), ProportionateResize, and async. The API returns the rotated image. Use the tester below to try it; more details are in the sections that follow.
Try the Rotate Image API
Endpoint: POST /api/v2/RotateImage · Required: api-key, docContent, docName, RotationAngle
Use the form below to send your API key and image (Base64). Set rotation angle (0-360) and optional background color; the response is the rotated image. No code required, fill the fields and click Send request.
Overview, parameters, and use cases
- Overview
- Parameters
- Use cases
What is Rotate Image?
This endpoint rotates an image by a custom angle (0-360 degrees). You provide the image (Base64), docName, RotationAngle, and optionally Backgroundcolor (hex, e.g. #FFFFFF) for areas revealed by rotation, and ProportionateResize to maintain proportions. The API returns the rotated image.
Key features
- Custom angle: RotationAngle in degrees (0-360).
- Background: Backgroundcolor (hex) for corners revealed by rotation.
- ProportionateResize: Optional proportional resize during rotation.
Use when you need a specific rotation angle (e.g. 90°, 180°). For auto-rotation from camera EXIF use Rotate Image by EXIF Data; for flipping use Flip Image.
API parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| api-key | string | Yes | Your PDF4me API key, Base64 encoded. Get it from the dashboard. |
| docContent | base64 | Yes | Image file content (Base64). Supported: JPG, PNG, GIF, BMP, TIFF. |
| docName | string | Yes | Output image file name. |
| RotationAngle | integer | Yes | Rotation angle in degrees (0-360). |
| Backgroundcolor | string | No | Background color (hex, e.g. #FFFFFF). |
| ProportionateResize | boolean | No | Maintain proportions during rotation. |
| async | boolean | No | Enable asynchronous processing. |
When to use Rotate Image
- Correct orientation: Rotate images to a specific angle (90°, 180°, 270°).
- Design: Apply custom rotation for layouts or graphics.
- Pipelines: Rotate after Create Image from PDF or Crop Image before distribution.
For request/response schemas and code samples, see Rotate Image in the PDF4me API docs.
Prerequisites
Before using this endpoint, make sure you have:
- A valid PDF4me API key (Get your API Key)
- An image file (JPG, PNG, GIF, BMP, TIFF) in Base64 format
Response Format
The API returns an image file with the specified rotation applied.