Image Optimization in Website - Web Essential
In
this article you will learn about Image Optimization using Web Essential Visual
Studio extension. You will learn how we can optimize individual image by right
clicking on image file, how to optimize group of images in the folder, how to
optimize image in CSS file and how to optimize Base64 Encode Image (dataUri) in
CSS file.
Web Essential
Web
Essentials extends Visual Studio with a lot of new features that web developers
have been missing for many years.
If
you ever write CSS, HTML, JavaScript, TypeScript, CoffeeScript or LESS, then
you will find many useful features that make your life as a developer easier.
This
extension is for all Web developers using Visual Studio. This extension was
first introduced in August 2012 by Mads
Kristensen.
Web
Essentials 1.7 for Visual Studio 2013 it is now easier than ever to work with
images.
If
you don’t have this extension installed in your favorite Visual Studio IDE then
you are missing many features, you can download it quickly
from here.
Now
let’s start exploring image optimization techniques with Web Essentials. There
are various ways we can optimize image(s), let’s look at those different ways
of doing same thing.
1. Optimize individual image by right
clicking on image file
To
do this, open Solution Explorer and right click on image to select Web
Essentials > Optimize image. Here is the screenshot.
Once
we click on ‘Optimize image’, you will notice the awesomeness in the status bar
below. Here is the screenshot.
We
can select multiple images by pressing Ctrl key and do same thing to optimize
multiple images in one click. Or we can optimize folder having images, let’s
look at this.
2. Optimize group of images in the folder
Here
I am going to optimize my ‘Images’ folder directly containing 14 images. Right
click on ‘Images’ folder to select Web Essentials > Optimize images. Here is
the screenshot.
Once
we click on ‘Optimize images’, you will notice the power of this extension. It
saved 45% total memory. Here is the screenshot.
You
also get same opportunity to optimize image inside CSS file also, it also does
same thing. Let’s explore this.
3. Optimize image in CSS file
We
can optimize image from CSS files also. Just click on the image line and select
‘Optimize Image’ in smart tag. Here is the screenshot.
It
does same thing as we explored in point 1 and 2.
4. Optimize Base64 Encode Image (dataUri)
in CSS file
In
case image is Base64 Encoded and embedded in the CSS file, we can optimize it
as well. Just click on the line and select ‘Optimize dataUri’ in the smart tag.
In
the above smart tag you can see we also get the opportunity to save this Base64
Encoded image text back to physical file or we can Re-embed the dataUri in case
image designer made any changes.
Hope
this helps.
Comments
Post a Comment