Logo

bistol.fi

Published on

Why I built and open-sourced the Eagle Image Optimization API

Authors

Images are essential to any website, and my motivation on building this open-source image optimization api is to enable everyone to give a better experience to their users. Having previously co-founded an Web Performance and Image Optimization company, I understand very well how these solutions might become unreachable and out of price for many.

An Open-source Image Optimization API levels the field, regardless of budget or technical expertise. I'm hoping this fosters innovation and experimentation, leading to a diverse landscape of solutions tailored to specific needs.

The benefits of optimizing images using Eagle Image Optimization API

  1. Accessibility for All: Large, unoptimized images can create significant barriers for users with slow internet connections or disabilities. Open-source image optimization shrinks file sizes, minimizing data consumption and ensuring everyone can access web content seamlessly.

  2. Democratization of Web Creation: Traditionally, image optimization tools have been expensive and complex, limiting access for smaller creators and businesses. Open-source solutions break down this barrier, empowering anyone to create high-quality, fast-loading content without significant financial or technical hurdles.

  3. Fostering Innovation and Collaboration: Open-source APIs encourage community involvement, with developers contributing code, fixes, and adaptations. This collaborative approach fosters continuous improvement, leading to innovative solutions tailored to diverse needs and emerging technologies.

  4. Building a Sustainable Web Ecosystem: By reducing server load and resource consumption, open-source image optimization contributes to a more sustainable web ecosystem. This benefits both developers by lowering server costs and the environment by minimizing energy usage.

  5. Enhancing User Experience: Faster loading times, improved accessibility, and optimized image quality all contribute to a better user experience. Open-source image optimization ensures users spend less time waiting and more time engaging with the content they seek.

Where to find Eagle Image Optimization API

The project is hosted on Github and can be found here with a detailed README on how to deploy it to AWS using the Serverless Framework.

How to use it

The API is very simple to use and it leverages query parameters to modify the image. Here's a list of the basic available parameters:

  • url: The url of the image to be optimized.
  • width: The width of the image to be resized.
  • height: The height of the image to be resized.
  • fit: When both a width and height are provided, the possible methods by which the image should fit.

* More advanced parameters can be found in the README file.

A sample URL would look like this:

{{API_ENDPOINT}}/api/v1/image?width=400&height=400&fit=contain&url={{IMAGE_URL}}

Example of an image optimized using the API:

https://d3kbkk2pyl9ybg.cloudfront.net/api/v1/image?width=200&height=200&url=https%3A%2F%2Feagle-image-test.s3.us-west-1.amazonaws.com%2Fpublic%2Feagle.jpeg

Example of an image optimized using the API

Run in Postman

To test the API you can use the following Postman collection

Run In Postman

Deploying to AWS

To deploy the API to AWS you can use the Serverless Framework. Once you have the Serverless Framework installed and you've configured your .env file with the settings you want to use for the API, you can deploy the API by running the following command:

serverless deploy --stage production

This will create a new CloudFormation stack in your AWS account and deploy the API.

ProTip: If you fork the repo you can deploy to AWS using github actions.

Let's Collaborate

The Eagle Image Optimization API is a powerful tool designed to democratize access to high-quality image optimization, making it accessible to everyone, regardless of their budget or technical expertise. By leveraging the open-source community, we're creating a sustainable, collaborative environment that fosters innovation and continuous improvement.

If you're passionate about optimizing web experiences or simply need a robust solution for your project, I encourage you to explore the API, contribute to the project, and share your feedback. The more we collaborate, the better we can make this tool for everyone.

I’m always open to connecting with fellow developers, entrepreneurs, or anyone interested in web performance. If you have any questions, need help deploying the API, or just want to chat about the project, feel free to reach out. You can ping me anytime—I'd love to hear from you!

Let’s build a faster, more accessible web together!