Image Resize

Hyperion can resize an image with the Hyperion.resizeImage message. The message takes a filePath and a size and returns a resized image.

In the Multiverse we use this in to create thumbnail images. We do the resize in multiverse.getScaledImageFile, which is used like multiverse.getFile, and called from thumb.hexm.

From the caller's perspective, Hyperion.resizeImage can be used in place of Aeon.fileDownload.


Hyperion caches the resized image in memory. When a request for a resized image comes in, we first look in the cache. If we can't find the image in the cache, we resize it, put it in the cache, and return it.

If the image is found in the cache, then we send a download message to Aeon with a modification timestamp. If the underlying Aeon file has not changed, then we return the cached image. Otherwise, we get the new file and resize it.

The cache has a limited size. When adding a new image to the cache we check to see if we've exceeded our limit. If we have, we remove the least recently used image.

Monitoring and Configuration

We need to add monitoring code to track the size of the cache and the usage pattern (cache hits/misses). We should add a message: Hyperion.getCacheStatus which should return a struct with appropriate information.

Eventually, we might want to allow the admin to configure the cache size. We should consider adding one or more options to CHyperionOptions and let the cache system access those options.

If we do that, we need to make Hyperion options persistent. We should add a message (perhaps via Exarch or Aeon) which allows any service to store and retrieve records.

Future Ideas

  • We could support additional image manipulations (grayscale, etc.).
  • We could support additional transformations, such as HTML/JavaScript minifying.
  • We could use the cache for other static files from Aeon.


  • 2019-02-26: Finished implementing the cache and image resize. End-to-end path works on Need to test cache use; need to add cache stats and diagnostics; need to deploy to
  • 2019-02-25: JPEG library can save images (see X5 project). Hyperion has a cache and can currently respond to Hyperion.resizeImage but returns a full-sized image. Need to add code to resize the image. We also still need to add code to invalidate the cache.