OpsLevel Logo
Product

Visibility

Catalog

Keep an automated record of truth

Context Layer (MCP)

Give your AI agents the curated answer

Integrations

Unify your entire tech stack

OpsLevel AI

Restoring knowledge & generating insight

Extensibility

Customize to meet your team’s needs

Standards

Maintenance Agent

Automate code maintenance at scale

New
Scorecards

Measure and improve software health

Campaigns

Action on cross-cutting initiatives with ease

Checks

Get actionable insights

Developer Autonomy

Self-service

Empower devs to do more on their own

Knowledge Center

Tap into API & Tech Docs in one single place

Featured Resource

OpsLevel's Maintenance Agent: The Last Mile of Code Maintenance, Automated
OpsLevel's Maintenance Agent: The Last Mile of Code Maintenance, Automated
Read more
Solutions

By Team

Platform Engineering

Empower teams with scalable platforms for faster, safer delivery.

Site Reliability

Ensure resilient systems with observability, automation, and reliability.

By Use Case

Improve Software Standards

Define, track, and enforce standards to strengthen software quality.

Developer Productivity

Accelerate developer workflows by removing friction and enabling focus.

Featured Resource

Demo: Infrastructure Checks in Seconds
Demo: Infrastructure Checks in Seconds
Read more
Customers
Our customers

We support leading engineering teams to deliver high-quality software, faster.

Customer reviews
Customer stories
Hudl
Hudl goes from Rookie to MVP with OpsLevel
Read more
Read more
Hudl
Keller Williams
Keller Williams’ software catalog becomes a vital source of truth
Read more
Read more
Keller Williams
Hootsuite
How Hootsuite Created a Robust Service Catalog for 700+ Microservices Using OpsLevel
Read more
Read more
Hootsuite
Resources
Our resources

Explore our library of helpful resources and learn what your team can do with OpsLevel.

All resources

Resource types

Blog

Resources, tips, and the latest in engineering insights

Guide

Practical resources to roll out new programs and features

Demo

Videos of our product and features

Events

Live and on-demand conversations

Interactive Demo

See OpsLevel in action

Pricing

Flexible and designed for your unique needs

Docs
Log In
Book a demo
Log In
Book a demo
Share this
Table of contents
 link
 
Resources
Blog

Ultra-Fast Thumbnail Generation with Jekyll and libvips

Product
DevX
Developer
Ultra-Fast Thumbnail Generation with Jekyll and libvips
Kenneth Rose
|
May 10, 2021
Ultra-Fast Thumbnail Generation with Jekyll and libvips

How we started: thumbnails with smartcropper

In the very early days of OpsLevel, our marketing website was powered by WordPress.  Even though our site then was small, WordPress was a pretty big moving part that required more maintenance than it was worth.  We found ourselves spending time on upgrading both WordPress and its plugins, debugging when things broke, and managing performance.  We also found that drafts were not a great workflow for previewing or staging changes as the live production site wouldn’t always look the same as a draft edit.

In mid-2019, we hopped aboard the Jamstack train and rebuilt our site (this site you’re reading now) using Jekyll.

One feature we wanted for our blog posts was automatic thumbnail generation.  Every blog post has a hero image (like the speedometer above) and we wanted smaller versions of this image for the blog index page.

We found Kari Silvennoinen’s blog post which describes a mechanism for using the smartcropper gem in a Jekyll generator.

We refactored things a bit for our use case (we generate multiple thumbnail sizes and also allow selectively overriding thumbnails).  However, the main call to smartcropper was nearly identical to Kari’s:

At the time, this change increased the build time of our site slightly.  Building the entire site would take about 10 seconds in devlocal and a few minutes to build on Netlify for production.  Not terrible and hey, we’re generating thumbnails, so obviously that’s going to take some time.

Bigger Site, Slower Build

Fast forward two years and we now have a lot more blog posts, which meant more thumbnails to generate.  During this period, the build time of our site creeped up to 30s - 40s for devlocal and 12+ minutes on Netlify.  Developing or changing our site was painful.  95% of the time was spent generating thumbnails, so we investigated to see if there was a better way.

Under the covers, smartcropper uses RMagick, which is Ruby interface for ImageMagick.

After some research, we found jekyll_picture_tag, which is based on libvips.  libvips bills itself as:

 libvips is a demand-driven, horizontally threaded image processing library. Compared to similar libraries, libvips runs quickly and uses little memory.

That sounds promising.  Let’s put it to the test.

libvips supports the same entropy-based cropping as smartcropper, so it was a straightforward replacement in our generator.  Here’s our new implementation of crop_and_scale:

libvips is fast

We profiled site build time with both smartcropper and libvips.

This is the output of jekyll build --profile:

🤯

Generating thumbnails with libvips is nearly 10x faster than smartcropper.

Ten.  Times.  Faster.

Full site builds now take < 4 seconds in devlocal and < 60 seconds on Netlify for production.  In addition, using Jekyll’s --incremental option in devlocal makes editing nearly instant.

The full implementation

Here’s our full implementation for generating thumbnails in Jekyll.

It’s pretty simple, but supports generating multiple thumbnails from a single image.  It also supports overriding thumbnails with an explicit file.

Put the following in _plugins/post_thumbnail_generator.rb:

‍

To specify the various thumbnail dimensions, add or customize the following in your _config.yml:

‍

In your posts, you can set thumbnail in the front matter.  For example, here’s this post’s front matter:

‍

Check us out

If you’re interested in performance, microservices, or helping teams adopt DevOps and service ownership, check out our open roles.

More resources

Richer context for both your humans and your AI agents
Blog
Richer context for both your humans and your AI agents

AI agents now query the same ownership, dependency, and on-call data engineers already rely on, over MCP.

Read more
The Internal Developer Portal in the Age of AI
Blog
The Internal Developer Portal in the Age of AI

AI is changing how software gets built, but it does not change the core problems engineering organizations need to solve. If anything, it makes them more important.

Read more
The Maintenance Work That Never Shows Up in Your Roadmap
Blog
The Maintenance Work That Never Shows Up in Your Roadmap

The gap between a standard your platform team defines and a codebase that actually reflects it is where engineering capacity quietly disappears.

Read more
Product
Software catalogMaturityIntegrationsSelf-serviceKnowledge CenterBook a meeting
Company
About usCareersContact usCustomersPartnersSecurity
Resources
DocsEventsBlogPricingDemoGuide to Internal Developer PortalsGuide to Production Readiness
Comparisons
OpsLevel vs BackstageOpsLevel vs CortexOpsLevel vs Atlassian CompassOpsLevel vs Port
Subscribe
Join our newsletter to stay up to date on features and releases.
By subscribing you agree to with our Privacy Policy and provide consent to receive updates from our company.
SOC 2AICPA SOC
© 2024 J/K Labs Inc. All rights reserved.
Terms of Use
Privacy Policy
Responsible Disclosure
By using this website, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Data Processing Agreement for more information.
Okay!