Service: Flyimg - EyevinnOSC/community GitHub Wiki

Flyimg

Flyimg (serviceId flyimg-flyimg, catalog page) is an on-the-fly image processing microservice: you give it a source image URL and control the output through URL parameters. It is a long-running service instance. License: MIT.

What it can do

  • Resize, crop and compress images from a source URL, with no SDK needed.
  • Convert between formats: JPEG (MozJPEG compression), WebP, AVIF, PNG and GIF. By default it generates AVIF when the browser supports it.
  • Act as an image CDN proxy for your application.

Creating an instance

Call create-service-instance with serviceId: "flyimg-flyimg". The only option is the instance name (alphanumeric, at most 20 characters). There are no dependencies.

{ "name": "myimages" }

Verify with wait-for-service-ready or get-instance-status, then use describe-service-instance for the base URL, which looks like https://<name>.flyimg-flyimg.auto.prod-se.osaas.io.

Options

Option Required Type Meaning
name Yes string Name of the instance. Alphanumeric, at most 20 characters.

Using the instance

Append processing options and the source image URL to the base path:

https://<instance-url>/upload/<options>/<source-image-url>

Resize to 400 x 300 and convert to WebP:

https://<instance-url>/upload/w_400,h_300,o_webp/https://example.com/photo.jpg

Resize with cropping (fill mode):

https://<instance-url>/upload/w_200,h_200,c_1/https://example.com/photo.jpg
Parameter Meaning Example
w_ Output width in pixels w_800
h_ Output height in pixels h_600
c_1 Enable cropping / fill mode c_1
o_ Output format (webp, avif, png, jpg) o_webp
q_ Quality 1 to 100 q_80
r_1 Progressive rendering r_1

As an image proxy in application code:

function imgUrl(src, width, height) {
  const base = 'https://myimages.flyimg-flyimg.auto.prod-se.osaas.io';
  return `${base}/upload/w_${width},h_${height},c_1,o_webp/${encodeURIComponent(src)}`;
}

Example with the OSC CLI:

osc create flyimg-flyimg myimages

Resources

⚠️ **GitHub.com Fallback** ⚠️