Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
December 26, 2021 04:54 pm GMT

How to quickly optimize images in a Github repository

Splash
Photo by Erik Mclean on Unsplash

It can be pretty common to just have some images bundled up in the repository. Taking into consideration the size of said images can be incredibly important to lower the size of the entire page/web app.

There are plenty of services online that can be used to optimize images but Github directly has access to a method of optimization!

In this short tutorial, Ill quickly go over how to set it up in your repo, this entire process should take under 5 minutes!

Marketplace

ImgBot

Within the Github marketplace, which can be accessed from the top bar of Github, you can access a variety of different tools for your repository! One of which is the ImgBot.

As per the description: Imgbot is a friendly robot that optimizes your images and saves you time. Optimized images mean smaller file sizes without sacrificing quality.

Great! Once youre on the page you can set up the plan. As a disclaimer, ImgBot does have paid plans for private repos but for public repos it is completely free!

After selecting the plan you can complete the installation, as an aside you can also select which repositories you specifically want to install it to.

Pull request

ImgBot Detail

After installing the ImgBot it will automatically create a pull request after analyzing all the images.

Itll even tell you exactly how much the images were reduced by:

And within detail itll give a breakdown of every single image that was altered:

Picture details

The way the ImgBot optimizes every file can be different but to give an example here are two files:

For a PNG file it reduces the size:

PNG files

Meanwhile, for an SVG it takes away all the empty space and essentially minifies it:

SVG file

Afterward, its just reviewing all the changes and accepting the PR merge into the main branch, as easy as that!

Let me know how it goes in the comments below or if you have any other optimizations for images.

More content at RelatableCode

Originally published at https://relatablecode.com on December 26, 2021.


Original Link: https://dev.to/diballesteros/how-to-quickly-optimize-images-in-a-github-repository-akn

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To