Tasks
Manipulate Image
This task manipulates images by performing operations such as rotation, cropping, resizing, quality adjustment, and grayscale conversion.
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.
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 required object
An object containing the manipulation operations to perform on the image. You can specify one or more operations. 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.
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.
Multiple operations on an image
Applies multiple manipulation operations: rotation, cropping, resizing, quality adjustment, and grayscale conversion.