File
File Manipulation
Trelae lets you transform uploaded files by queuing one or more operations—such as resizing, cropping, tinting, adding text—and then applying them all at once with .save()
.
Currently, only image files (image/*) are supported for manipulation. Support for PDFs and additional file types is coming soon.
Supported Operations (current image support)
- resize / crop
- compress / convert / rotate / flip
- border / background
- grayscale, blur, sharpen, tint, adjust
- threshold, trim
- composite (overlay another file/image)
- addText
- removeBackground
How It Works
- Create a file handle:
const file = trelae.file('FILE_ID')
- Chain operations:
file.resize({ width: 400 }).rotate(90)...
- Apply everything with
.save()
Next Steps
See the full guide with code examples for every operation: