Optimizing 1,300+ Images using 'sharp'
I found out about the "sharp" image library when I was migrating my website from WordPress to 11ty, as it was mentioned somewhere on the 11ty documentation page. And coincidentally, only a few days later, I had to optimize over 1,300 images for a project and I immediately moved to using sharp
.
I even created a GitHub repository (have named it OptiSharp) and have put all the code there. You can also watch this quick video to understand how it works.
How OptiSharp works
OptiSharp is a simple tool that makes your images smaller and better for the web. Here's how it works:
#1. Put your images in: Just drop all your images into the input
folder.
#2. Choose your settings: You can easily change a few settings like:
- How small you want the images to be
- What type of image you want (JPEG, PNG, WebP, etc.)
- How good the quality should be
- If you want to keep the image information (like camera details)
#3. Run the tool: Type one command, and it will:
- Look at all your images
- Make them smaller
- Save them in the
output
folder - Tell you how much space you saved
#4. Get results: After it's done, you'll see:
- How many images it processed
- How much smaller they are now
- How long it took
- If there were any problems
Why I made this
I needed to make lots of images smaller for websites, and doing it one by one was taking too long. Most online tools:
- Only let you do a few images at a time
- Have size limits
- Sometimes make you pay
- Don't give you many options
OptiSharp solves these problems because it:
- Can handle hundreds of images at once
- Works on your own computer
- Is completely free
- Lets you control exactly how you want to change your images
How to use it
- Make sure you have Node.js on your computer
- Download OptiSharp from GitHub
- Put your images in the input folder
- Run the program
- Get your optimized images from the output folder
It's that simple! The tool will show you how much space you saved and if there were any problems.
What's next?
I'm planning to add more features like:
- A simple screen where you can change settings without coding
- More ways to make images look better
- Ability to rename files automatically
If you want to try OptiSharp, visit the GitHub page and follow the instructions. It's free and open for everyone to use and improve!
- ← Previous
Taking Notes in VS Code - Next →
Trying Out the New Android Linux Terminal