File

Image Manipulation

Trelae lets you perform image manipulation operations on files after upload.
Currently, only image files are supported — more file types will be added in future updates.

Each operation is validated, queued, and combined before you run .save() to apply all edits at once.


How It Works

  1. Choose the edits you want to make to an image — like cropping, resizing, or adding effects.
  2. Add each edit to your file’s list of operations.
  3. Combine multiple edits by chaining them together in any order.
  4. When you’re ready, apply all edits in one go with .save().

Supported Operations (with all options)

  • resizewidth?, height?, withoutEnlargement?, fastShrinkOnLoad?
  • cropwidth, height, left?, top?, position?
  • compressquality?
  • rotateangle?
  • fliphorizontal?, vertical?
  • convertformat (jpeg, png, webp, avif, tiff, gif)
  • borderwidth?, color?, topWidth?, bottomWidth?, leftWidth?, rightWidth?, topColor?, bottomColor?, leftColor?, rightColor?
  • backgroundcolor?
  • grayscale — no options
  • blursigma?
  • sharpensigma?, m1?, m2?
  • tintcolor
  • adjustbrightness?, saturation?, hue?
  • thresholdthreshold?
  • trimthreshold?
  • compositeforegroundImageId, top?, left?, gravity?, blend?, tile?, opacity?, width?, height?
  • addTexttexts[]: text, fontFamily, fontSize, fontWeight, color, opacity, left, top, align?, italic?, underline?, rotate?, letterSpacing?, hTilt?, vTilt?
  • removeBackground — no options

Resize

Change the dimensions of the image. You can supply one or both dimensions; the original aspect ratio is preserved automatically when only one is provided. withoutEnlargement prevents upscaling small images, and fastShrinkOnLoad speeds up large downscales.

Crop

Cut out a rectangular region of the image. Provide width/height and optionally left/top offsets or a position keyword like "center".

Compress

Reduce file size by lowering quality (0–100). Works best with lossy formats (e.g. JPEG/WebP).

Rotate

Rotate the image clockwise by a number of degrees. If no value is passed, 90° is used by default.

Flip

Mirror the image horizontally, vertically, or both.

Convert

Change the output format. Useful for producing WebP/AVIF versions or converting to PNG/JPEG.

Border

Add a border around the image. You can set a global width/color and override individual sides.

Background

Fill the empty/transparent areas with a solid color.

Grayscale

Remove color information for a classic monochrome look.

Blur

Apply Gaussian blur using sigma to control strength.

Sharpen

Increase edge clarity. Tweak sigma, m1, and m2 to adjust the algorithm.

Tint

Apply a color wash across the image using a hex or named color.

Adjust

Fine-tune brightness, saturation, or hue (in degrees) in a single call.

Threshold

Convert the image to pure black/white based on a luminance cutoff (0–255).

Trim

Remove uniform borders of similar color around the edges. Increase threshold for more tolerance.

Composite

Overlay another image with positioning, optional scaling, tiling, blend mode, and opacity.

Remove Background

Automatically isolate the foreground using AI and remove the background.

Add Text

Draw one or more styled text layers onto the image with positioning and advanced typography options.


Chaining & Save

You can chain any number of operations before calling .save() — they will all be applied together in a single request.


Try It Live

Want to experience interactively? Open the Image Editor to upload an image and apply these operations in the browser.
You’ll see a real-time preview and can copy the generated SDK code for your own project.