Skip to content
AWS Lambda Layer for Ruby Libvips Gem
Dockerfile Shell
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Install libimagequant for PNG compression. Jan 31, 2020

Ruby Libvips Lambda Layer

Lamby: Simple Rails & AWS Lambda Integration using Rack.Are you using the ruby-vips gem? Maybe you are using the ImageProcessing::Vips interface of the fantastic image_processing gem which Rails v6 & ActiveStorage will use?

Maybe you are using our Lamby infrastructure to deploy your Rails app to AWS Lambda using simple Rack integration and documentation? If yes to any of the above, this Lambda Layer is just for you.

Lamby: Simple Rails & AWS Lambda Integration using Rack.


  • Clone or fork this repository.
  • Make sure you have Docker or AWS CLI installed.
  • Run ./bin/deploy

From there you simply use the arn in your AWS SAM template.yaml file.


Simplicity and small file size! We followed the docs for libvips install. But because AWS Lambda already has ImageMagick and lots of the needed dependencies, the work was very basic.

We used the lambci/lambda:build-ruby2.5 Docker image from the docker-lambda project. From there we only had to install a few more dependencies to get libvips installed. The current version is v8.7.4 and easy to configure if you need something else.

Lastly, we were happy to find that glib and gobject were already installed and all that was needed were some simple sym links so FFI could load these libraries.


Because of the way we build libvips by using existing libraries already installed on AWS Lambda, the resulting layer is very small. Only around 10MB in total un-compressed size.

$ ls -lAGp /opt/lib
lrwxrwxrwx 1 root      27 Jan 30 18:08 -> /usr/lib64/
lrwxrwxrwx 1 root      30 Jan 30 18:08 -> /usr/lib64/
lrwxrwxrwx 1 root      18 Jan 30 18:08 ->
-rw-r--r-- 1 root   56576 Jan 30 18:08
lrwxrwxrwx 1 root      18 Jan 30 18:08 ->
lrwxrwxrwx 1 root      18 Jan 30 18:08 ->
-rwxr-xr-x 1 root 9954128 Jan 30 18:08

$ ls -lAGp /opt/include
-rw-r--r-- 1 root    6942 Jan 30 18:08 libimagequant.h
You can’t perform that action at this time.