weserv/images
repository·5.x·Indexed 25 days ago
https://github.com/weserv/imagesA self-hostable image processing service (formerly images.weserv.nl) that allows developers to manipulate and serve images via a web interface. It features a custom Nginx module with proxy and filter modes, supporting various image formats including JPEG, WebP, AVIF, and JPEG XL. The service provides extensive configuration for image quality, compression effort, and resource limits, and can be deployed via Docker or built from source using libvips.
What's inside weserv/images
- weserv/images (formerly images.weserv.nl) is an image processing service designed to be deployed on your own servers. It provides image handling and manipulation capabilities by leveraging high-performance libraries and web server technologies.
Access weserv/images documentation and API reference
5.xDetailed information regarding the usage of the service, including the API reference and general documentation, can be found at the official website (https://wsrv.nl/) or via the project's wiki documentation on GitHub.Deploy weserv/images using Docker
5.xTo deploy weserv/images using Docker, refer to the dedicated installation instructions located in thedocker/README.mdfile within the repository.Run weserv/images using the hosted Docker image
5.xYou can pull and run the pre-built container from the GitHub Container Registry. This command maps TCP port 80 inside the container to port 8080 on your host and sets the shared memory size to 1GB.
docker run -d -p 8080:80 --shm-size=1gb --name=weserv ghcr.io/weserv/images:5.xBuild and install weserv/images from source
5.xTo build the project, clone the repository with submodules, use
mesonto configure and compile the build, and then install it. After installing the core project, you must build and install a custom Nginx instance configured with the project's module.# Build and install weserv/images git clone --recurse-submodules https://github.com/weserv/images.git cd images meson setup build --prefix=/usr meson compile -C build meson install -C build # Build and install custom Nginx with the module mkdir nginx curl -Ls https://nginx.org/download/nginx-1.31.2.tar.gz | \ tar xzC nginx --strip-components=1 cd nginx ./configure --add-module=../ --with-http_ssl_module make -j$(nproc) make installInstall dependencies and libvips on RHEL 10
5.xFollow these steps to configure repositories and install the necessary packages for
weserv/imageson RHEL 10 systems. This includes setting up EPEL, CodeReady Builder, Remi, and RPM Fusion repositories to ensure all required libraries (likelibheif) are available.# Install the EPEL repository configuration package dnf install epel-release # Enable the CodeReady Builder repository crb enable # or: # subscription-manager repos --enable "codeready-builder-for-rhel-10-$(uname -m)-rpms" # Install the Remi repository configuration package dnf install https://rpms.remirepo.net/enterprise/remi-release-10.rpm # Install the RPM Fusion repository configuration package (for libheif) dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-10.noarch.rpm # Enable Remi's RPM repository dnf config-manager --set-enabled remi # Install libvips (+ development files and command-line tools) dnf install vips vips-devel vips-tools # Install optional modules dnf install vips-heif vips-jxl vips-magick-im7 vips-poppler # Install build requirements dnf group install 'Development Tools' dnf install meson openssl-devel pcre2-devel zlib-develManually build and run the weserv/images container
5.xTo build the container from source with a specific Nginx version, use thedocker buildcommand with theNGINX_VERSIONbuild argument. Once built, you can run the local image using the same parameters as the hosted image.Enable the Weserv module in nginx
5.xUse the
weservdirective to enable the Weserv module for nginx requests. You must choose between two backend modes:proxy: Processes images from a remote server specified via the?url=query parameter.filter: Processes images from responses generated by other nginx handlers (such as static content or proxied requests).
Install build dependencies for RHEL 10
5.xTo build
weserv/imagesfrom source on RHEL 10 or its derivatives, ensure the following dependencies are met:meson>= 0.63g++>= 5.0pcre2(for nginx rewrite module)zlib(for nginx gzip module)openssl(for SSL support)libvips>= 8.12
Manage nginx configuration inside the container
5.xUse
docker execto perform administrative tasks on the Nginx service running inside theweservcontainer.# Check nginx configuration for correct syntax docker exec weserv nginx -t # Reload the nginx configuration file docker exec weserv nginx -s reloadMaintain and inspect the weserv container
5.xUse these commands to manage the container environment, update packages, or inspect system settings.
# Access the container bash shell docker exec -it weserv bash # Update RPM packages docker exec weserv dnf update -y # Check jemalloc configuration docker exec -e MALLOC_CONF="stats_print:true,stats_print_opts:mdablxeh" weserv bash # Access to logs docker logs weserv # Retrieve the container's IP Address docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -f name=weserv -q) docker inspect $(docker ps -f name=weserv -q) | grep IPAddressConfigure image quality and compression effort
5.xAdjust the default quality and CPU effort for various image formats. Quality values are 1-100. Effort values vary by format:
Quality
weserv_quality <quality>: Default for JPEG, WebP, TIFF, AVIF, and JPEG XL. Default:80.- Format-specific overrides (if
weserv_qualityis not set):weserv_avif_quality <quality>weserv_jpeg_quality <quality>weserv_jxl_quality <quality>weserv_tiff_quality <quality>weserv_webp_quality <quality>
Compression Effort
weserv_avif_effort <effort>: 0 (fastest) to 9 (slowest). Default:4.weserv_jxl_effort <effort>: 1 (fastest) to 10 (slowest). Default:7.weserv_gif_effort <effort>: 1 (fastest) to 10 (slowest). Default:7.weserv_webp_effort <effort>: 0 (fastest) to 6 (slowest). Default:4.weserv_zlib_level <level>: PNG compression level 0 (fastest) to 9 (slowest). Default:6.