Tasks
Manipulate Image
Transforms images through operations such as crop, resize, rotate, quality adjustment, and grayscale conversion, and converts images between file formats. Useful for media cleanup, thumbnails, and image-processing workflows.
Use Cases
- Rotating images that are not oriented correctly to allow for better LLM understanding.
- Reducing image quality to reduce image filesize and optimize storage.
- Cropping images to focus on specific regions of interest.
- Resizing images to meet specific dimension requirements.
- Converting images to grayscale for document processing or analysis.
- Converting images to a different file format, such as an SVG logo to a PNG that can be sent on WhatsApp or added to a PDF.
Basic usage
Parameters
files required object[]
An array of file objects. Each object contains file metadata.
Show child attributes
fileuuid required string
The unique identifier of the image file that should be manipulated.
operations optional object
An object containing the manipulation operations to perform on the image. You can specify one or more operations. Required unless output_settings is provided. Available operations:
Show child attributes
crop
Crops the image to specified dimensions and offset.
widthnumber- Width of the cropped area in pixelsheightnumber- Height of the cropped area in pixelsx_offsetnumber- Horizontal offset from the top-left corner in pixelsy_offsetnumber- Vertical offset from the top-left corner in pixels
rotate
Rotates the image by the specified degrees.
degreesnumber- Rotation angle in degrees (e.g., 90, 180, 270)
resize
Resizes the image to specified dimensions.
widthnumber- New width in pixelsheightnumber- New height in pixels
adjust_quality
Adjusts the image quality/compression level.
qualitynumber- Quality level from 1-100, where 100 is highest quality
grayscale
Converts the image to grayscale when set to true.
output_settings optional object
The details of the files to create. Use this to convert images to a different file format. The conversion happens after all operations have been applied.
If omitted, each image keeps its original format. SVG images are the exception, they are always output as PNG.
Show child attributes
content_type required string
The type of file to produce. The file extension of each image is changed to match, for example logo.svg becomes logo.png.
Supported: image/png | image/jpeg | image/webp | image/avif | image/gif | image/tiff
JPEG and TIFF do not support transparency, so any transparent areas are filled with white.
To set the size of a converted SVG, add a resize operation. The SVG is drawn at the new size, so it stays sharp at any size.
Result
Properties
images array
An array of file objects representing the manipulated images. Each object contains:
filenamestring- The filename of the manipulated imageoriginalnamestring- The original filenamefileuuidstring- The unique identifier of the manipulated image filecontentTypestring- The MIME type of the image
Examples
Rotate an image 90 degrees
Rotates an uploaded image 90 degrees clockwise.
Reduce image quality for optimization
Reduces the image quality to 50% to decrease file size.
Crop and resize an image
Crops a specific region from an image and then resizes it.
Convert to grayscale for document processing
Converts an image to grayscale and reduces quality for document processing workflows.
Convert an SVG to a PNG
Converts an SVG image to a PNG without changing anything else about the image.
Multiple operations on an image
Applies multiple manipulation operations: rotation, cropping, resizing, quality adjustment, and grayscale conversion.