<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Image Optimization Archives &#8211; Wadiweb</title>
	<atom:link href="https://www.wadiweb.com/tag/image-optimization/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description></description>
	<lastBuildDate>Mon, 11 Mar 2024 23:28:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
	<item>
		<title>Enable uploading AVIF Images on WordPress website</title>
		<link>https://www.wadiweb.com/uploading-avif-images-wordpress/</link>
		
		<dc:creator><![CDATA[Mohammed Rezq]]></dc:creator>
		<pubDate>Mon, 11 Mar 2024 23:28:16 +0000</pubDate>
				<category><![CDATA[Website Optimization]]></category>
		<category><![CDATA[Image Optimization]]></category>
		<category><![CDATA[Page speed loading]]></category>
		<guid isPermaLink="false">https://www.wadiweb.com/?p=4645</guid>

					<description><![CDATA[<p>Enabling AVIF images on your WordPress website can significantly enhance your site&#8217;s loading speed and overall performance. AVIF (AV1 Image File Format) is a modern image format that offer superior compression efficiency compared to traditional formats like JPEG and PNG. This means they can make your website faster by reducing the size of the images...</p>
<p>The post <a href="https://www.wadiweb.com/uploading-avif-images-wordpress/">Enable uploading AVIF Images on WordPress website</a> appeared first on <a href="https://www.wadiweb.com">Wadiweb</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Enabling AVIF images on your WordPress website can significantly enhance your site&#8217;s loading speed and overall performance. AVIF (AV1 Image File Format) is a modern image format that offer superior compression efficiency compared to traditional formats like JPEG and PNG. This means they can make your website faster by reducing the size of the images it needs to load, without compromising on image quality.</p>



<p>So, in your WordPress theme add this code into functions.php<br></p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP" data-show-lang="1"><code>function custom_mime_types( $mime_types ) {
$mime_types[&#39;avif&#39;] = &#39;image/avif&#39;; // Adding .avif
return $mime_types;
}
add_filter( &#39;mime_types&#39;, &#39;custom_mime_types&#39; );

function add_avif_upload_support( $checked, $file, $filename, $mimes ) {
if ( ! $checked[&#39;type&#39;] ) {
$check_filetype = wp_check_filetype( $filename, $mimes );
$ext = $check_filetype[&#39;ext&#39;];
$type = $check_filetype[&#39;type&#39;];
$proper_filename = $filename;

    if ( $type && 0 === strpos( $type, &#39;image/&#39; ) && $ext !== &#39;svg&#39; ) {
        $checked = compact( &#39;ext&#39;, &#39;type&#39;, &#39;proper_filename&#39; );
    } else {
        $checked = array( &#39;ext&#39; =&gt; false, &#39;type&#39; =&gt; false, &#39;proper_filename&#39; =&gt; false );
    }
}

return $checked;

}
add_filter( &#39;wp_check_filetype_and_ext&#39;, &#39;add_avif_upload_support&#39;, 10, 4 );</code></pre></div>



<p>Now you should be able to upload AVIF images into your WordPress website with no problems!.</p>
<p>The post <a href="https://www.wadiweb.com/uploading-avif-images-wordpress/">Enable uploading AVIF Images on WordPress website</a> appeared first on <a href="https://www.wadiweb.com">Wadiweb</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Resize Images for Your Website</title>
		<link>https://www.wadiweb.com/how-to-resize-images-for-your-website/</link>
		
		<dc:creator><![CDATA[Mohammed Rezq]]></dc:creator>
		<pubDate>Sat, 01 Oct 2022 13:54:37 +0000</pubDate>
				<category><![CDATA[Website Optimization]]></category>
		<category><![CDATA[Image Optimization]]></category>
		<category><![CDATA[Image Resizing]]></category>
		<category><![CDATA[Page speed loading]]></category>
		<guid isPermaLink="false">https://www.wadiweb.com/?p=3785</guid>

					<description><![CDATA[<p>Websites nowadays contains hundreds if not thousands of images, so resizing images in bulk for your website is essential. Many online services and WordPress plugins provide such service, but it might be limiting to some extent. Using JavaScript you can achieve a very good results with minimal effort and almost for free!. We will be...</p>
<p>The post <a href="https://www.wadiweb.com/how-to-resize-images-for-your-website/">How to Resize Images for Your Website</a> appeared first on <a href="https://www.wadiweb.com">Wadiweb</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Websites nowadays contains hundreds if not thousands of images, so resizing images in bulk for your website is essential. Many online services and WordPress plugins provide such service, but it might be limiting to some extent. Using JavaScript you can achieve a very good results with minimal effort and almost for free!.</p>



<p>We will be using Sharp Js Library which is an great library for optimizing, resizing , It also has many other features that will help you to improve your images with ease. In this article, we will focus on resizing images using Sharp.</p>



<p><strong>Sharp </strong>requires Node.js to be installed on your Operating System, which you can download below. ( I recommend downloading and installing the stable version for your operating system ).</p>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="wp-block-button alignleft has-custom-font-size is-style-fill" style="font-size:16px"><a class="wp-block-button__link" href="https://nodejs.org/en/download/" target="_blank" rel="noreferrer noopener">Download Node</a></div>
</div>



<p></p>



<p><strong>Sharp</strong> is a high-speed Node.js module to convert large images in standard formats to smaller, web-friendly JPEG, PNG, WebP, GIF, and AVIF images of varying dimensions.</p>



<p>Using <strong>Sharp</strong> to resize your images is very easy to do, and we will go through the steps to resize your images in bulk for your website.</p>



<h2 class="wp-block-heading">1- Install Sharp Library</h2>



<p>The first step is installing Sharp using npm or yarn</p>



<p>Open your command line terminal in this folder, -I use&nbsp;<a href="https://git-scm.com/downloads" target="_blank" rel="noreferrer noopener">Gitbash</a>– then run the following command</p>



<h4 class="wp-block-heading">NPM</h4>



<p>If you have npm installed then run this line.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>npm i sharp</code></pre></div>



<h4 class="wp-block-heading">Yarn</h4>



<p>Or you can replace npm install with yarn add if you have yarn in your system.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>yarn add sharp</code></pre></div>



<p>It should install the required packages within moments.</p>



<h2 class="wp-block-heading">Script</h2>



<p>Now we should create a new file that will contain our code to resize images, Create a file name <strong>index.js</strong> and add the following code.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-js" data-lang="JavaScript"><code>const sharp = require(&quot;sharp&quot;);
const fs = require(&quot;fs&quot;);
const path = require(&quot;path&quot;);</code></pre></div>



<p>The packages are Sharp Library(sharp) which we just installed earlier, Filesystem (fs), and path (path) packages which should already.</p>



<p>Now let&#8217;s create a folder that will contain our original images we will name (images). and another folder for outputting resized images we will name (output). </p>



<p>The packages and folders should look something like this</p>



<h4 class="wp-block-heading">Images Resizing Structure</h4>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="355" src="https://cdn.wadiweb.com/wp-content/uploads/2022/10/01134851/sharp-optimizing-1024x355.webp" alt="" class="wp-image-4133" srcset="https://cdn.wadiweb.com/wp-content/uploads/2022/10/01134851/sharp-optimizing-1024x355.webp 1024w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01134851/sharp-optimizing-300x104.webp 300w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01134851/sharp-optimizing-768x266.webp 768w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01134851/sharp-optimizing.webp 1228w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>You can clone the structure and the code from the <a href="https://github.com/mohammedrezq/sharp-optimizing-images" target="_blank" rel="noreferrer noopener nofollow">GitHub repo Sharp Images Optimization</a></p>



<p>We will add the original images that we will <strong>resize</strong> to the (<strong>images</strong>) folder.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-js" data-lang="JavaScript"><code>const directoryName = &quot;images&quot;;

const fileNames = fs.readdirSync(directoryName);</code></pre></div>



<p>directoryName variable is the images folder name, and filesNames variable we get to loop through for resizing using Sharp.</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-js" data-lang="JavaScript"><code>
fileNames.forEach((file) =&gt; {

  const fileFormat = getExtension(file);
  let sh = sharp(&quot;./images/&quot; + file);

  if( &#39;jpg&#39; == fileFormat ) {
    sh.jpeg({
      quality: 80,
      progressive: true,
    }).resize(
      {
        fit:  sharp.fit.contain,
        width: 900,
      }
    )
  } 
});

function getExtension(filename) {
  let ext = path.extname(filename || &quot;&quot;).split(&quot;.&quot;);

  return ext[ext.length - 1];
}</code></pre></div>



<p>Now we will loop through all images that are jpg formatted, and set those images&#8217; quality to 80 (percent) you can set the number higher or lower. you can read more about available options for image optimization (<a href="https://sharp.pixelplumbing.com/api-output">Output Images</a>).</p>



<p>Resizing Images use the method resize, and we will keep images same dimensions, width is set to 900 (PX), this will make the images&#8217; width to 900 Pixels and the height will be resized accordingly with the same dimensions.</p>



<p>You can check more options from (<a href="https://sharp.pixelplumbing.com/api-resize" target="_blank" rel="noreferrer noopener nofollow">Resizing Images</a>) Options.</p>



<p>Add similar logic for WebP and PNG formatted images</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-js" data-lang="JavaScript"><code>fileNames.forEach((file) =&gt; {

  const fileFormat = getExtension(file);
  let sh = sharp(&quot;./images/&quot; + file);

  if( &#39;jpg&#39; == fileFormat ) {
    sh.jpeg({
      quality: 80,
      progressive: true,
    }).resize(
      {
        fit:  sharp.fit.contain,
        width: 900,
      }
    )
  } else if (&#39;png&#39; === fileFormat) {
    sh.png({
      quality: 80,
      progressive: true,
    }).resize(
      {
        fit:  sharp.fit.contain,
        width: 900,
      }
    )
  } else if(&#39;webp&#39; === fileFormat){
    sh.webp({lossless:true, quality: 80, alphaQuality: 100, force: true}).resize(
        {fit: sharp.fit.contain, width: 900}
      )
  }
});

function getExtension(filename) {
  let ext = path.extname(filename || &quot;&quot;).split(&quot;.&quot;);

  return ext[ext.length - 1];
}</code></pre></div>



<p>The final code in index.js file should be</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-js" data-lang="JavaScript"><code>// Packages
const sharp = require(&quot;sharp&quot;);
const fs = require(&quot;fs&quot;);
const path = require(&quot;path&quot;);

// Original Images directory
const directoryName = &quot;images&quot;;

// Get file names
const fileNames = fs.readdirSync(directoryName);

// Loop through images
fileNames.forEach((file) =&gt; {

  // Get image format (extension)
  const fileFormat = getExtension(file);

  console.log(&quot;fileFormat&quot;, fileFormat)
  if (fileFormat === &quot;svg&quot;) {
    console.log(&quot;SVGs are not processed in this script at the moment&quot;);
    return;
  }
  let sh = sharp(&quot;./images/&quot; + file);

  if( &#39;jpg&#39; == fileFormat ) {
    sh.jpeg({
      quality: 80,
      progressive: true,
    }).resize(
      {
        fit:  sharp.fit.contain,
        width: 900,
      }
    )
  } else if (&#39;png&#39; === fileFormat) {
    sh.png({
      quality: 80,
      progressive: true,
    }).resize(
      {
        fit:  sharp.fit.contain,
        width: 900,
      }
    )
  } else if(&#39;webp&#39; === fileFormat){
    sh.webp({lossless:true, quality: 80, alphaQuality: 100, force: true}).resize(
        {fit: sharp.fit.contain, width: 900}
      )
  }


  console.log(&#39;output/&#39; + file);
  let fileNameWOExtension = file.replace(/\.[^/.]+$/, &quot;&quot;);

  console.log(fileNameWOExtension);


  sh.toFile(&#39;output/&#39; + `${file}`, function (err, info) {
    // console.log(info);
    if(err) {
      console.log(err + &quot;Error occurred while optimization process&quot;)
    }
  })
});

// Get Image Extension
function getExtension(filename) {
  let ext = path.extname(filename || &quot;&quot;).split(&quot;.&quot;);

  return ext[ext.length - 1];
}
</code></pre></div>



<p>After finishing the code and organizing our folders Let&#8217;s add our images and test resizing images</p>



<p>In images folder we have about 25 images free from <a href="https://www.pexels.com/">pexels</a>, images varying in size so we will use Sharp to resize those images making their width 900 Pixels and the height will resize to the same aspect ratio.</p>



<p>Run the following command in the Visual Studio Code terminal (or Git bash or any other terminal to run your commands).</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="576" src="https://cdn.wadiweb.com/wp-content/uploads/2022/10/01132252/node-index.-resizing-images-1024x576.webp" alt="" class="wp-image-4121" srcset="https://cdn.wadiweb.com/wp-content/uploads/2022/10/01132252/node-index.-resizing-images-1024x576.webp 1024w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01132252/node-index.-resizing-images-300x169.webp 300w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01132252/node-index.-resizing-images-768x432.webp 768w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01132252/node-index.-resizing-images-1536x864.webp 1536w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01132252/node-index.-resizing-images.webp 1919w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<div class="hcb_wrap"><pre class="prism line-numbers lang-bash" data-lang="Bash"><code>node index.js</code></pre></div>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="576" src="https://cdn.wadiweb.com/wp-content/uploads/2022/10/01132301/resized-images-1024x576.webp" alt="" class="wp-image-4124" srcset="https://cdn.wadiweb.com/wp-content/uploads/2022/10/01132301/resized-images-1024x576.webp 1024w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01132301/resized-images-300x169.webp 300w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01132301/resized-images-768x432.webp 768w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01132301/resized-images-1536x864.webp 1536w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01132301/resized-images.webp 1919w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>You should see the console logs appear in the terminal while resizing images. The time of resizing images depends on the size and quantity of the images. So 25 images didn&#8217;t take more than 2 seconds.</p>



<p>So, let&#8217;s see images before and after resizing dimensions</p>



<h4 class="wp-block-heading">Before Resizing</h4>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="692" height="1024" src="https://cdn.wadiweb.com/wp-content/uploads/2022/10/01135905/before-692x1024.jpg" alt="" class="wp-image-4142" srcset="https://cdn.wadiweb.com/wp-content/uploads/2022/10/01135905/before-692x1024.jpg 692w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01135905/before-203x300.jpg 203w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01135905/before-768x1137.jpg 768w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01135905/before-1037x1536.jpg 1037w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01135905/before-1383x2048.jpg 1383w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01135905/before-scaled.jpg 1729w" sizes="(max-width: 692px) 100vw, 692px" /></figure>



<h4 class="wp-block-heading">After Resizing</h4>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="691" height="1024" src="https://cdn.wadiweb.com/wp-content/uploads/2022/10/01135853/after-691x1024.jpg" alt="" class="wp-image-4141" srcset="https://cdn.wadiweb.com/wp-content/uploads/2022/10/01135853/after-691x1024.jpg 691w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01135853/after-203x300.jpg 203w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01135853/after-768x1137.jpg 768w, https://cdn.wadiweb.com/wp-content/uploads/2022/10/01135853/after.jpg 900w" sizes="(max-width: 691px) 100vw, 691px" /></figure>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Resizing images using Sharp doesn&#8217;t require much work after the initial setup. you can resize your images very fast and with many custom options available.</p>



<p>Learn how to optimize images for your website to be production ready (<a href="https://www.wadiweb.com/how-to-optimizie-images-for-your-website/">How to Optimize Images for Your Website</a>).</p>
<p>The post <a href="https://www.wadiweb.com/how-to-resize-images-for-your-website/">How to Resize Images for Your Website</a> appeared first on <a href="https://www.wadiweb.com">Wadiweb</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Optimize Images For Your Website</title>
		<link>https://www.wadiweb.com/how-to-optimizie-images-for-your-website/</link>
		
		<dc:creator><![CDATA[Mohammed Rezq]]></dc:creator>
		<pubDate>Sat, 10 Sep 2022 08:40:36 +0000</pubDate>
				<category><![CDATA[Website Optimization]]></category>
		<category><![CDATA[Image Optimization]]></category>
		<category><![CDATA[Page speed loading]]></category>
		<guid isPermaLink="false">https://www.wadiweb.com/?p=3517</guid>

					<description><![CDATA[<p>Modern websites require lots of media and images to be nice and engaging, but that doesn't have to be at the cost of page speed. Image optimization can help your web pages to have many images and media and still load fast.</p>
<p>The post <a href="https://www.wadiweb.com/how-to-optimizie-images-for-your-website/">How to Optimize Images For Your Website</a> appeared first on <a href="https://www.wadiweb.com">Wadiweb</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Images tend to be the cause of huge bandwidth consumption on modern websites, so knowing that and how to optimize images can save you a lot of money and time. There are 3 ways you can use to optimize your image:</p>



<ul class="wp-block-list"><li>WordPress optimizing plugins. (Mostly Paid)</li><li>Websites for Optimizing Images. (Freemium)</li><li>Optimizing Images Using JS Libraries. (Free)</li></ul>



<h2 class="wp-block-heading">Optimizing Images Using JS Libraries</h2>



<p>Optimizing Images through writing a simple JS script is free and easy and my choice which I use on most of my posts and pages. JS libraries can scale easily you can optimize hundreds of images with just a few lines of code at -almost- no cost.</p>



<p>There are many JS libraries for optimizing images out there but we will focus on <strong><em>Imagemin </em></strong>which is the most popular and used, Imagemin is open source JavaScript Library and easy to use, and with great documentation.</p>



<ul class="wp-block-list"><li><strong><em>Imagemin</em></strong></li></ul>



<p><strong><em>Imagemin </em></strong>requires Node.js to be installed on your Operating System, which you can download below. ( I recommend downloading and installing the stable version for your operating system ).</p>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="wp-block-button alignleft"><a class="wp-block-button__link" href="https://nodejs.org/en/download/" style="border-radius:0px" target="_blank" rel="noreferrer noopener">Download Node</a></div>
</div>



<h2 class="wp-block-heading">Imagemin</h2>



<p><strong><em>Imagemin </em></strong>package is a great choice for optimizing your images, with a simple script you can crop, resize, and compress your images to reduce the size of images, reducing webpages size.</p>



<p>Using <strong><em>Imagemin </em></strong>package is very straightforward and simple, you can go through its documentation and available options <a href="https://github.com/imagemin/imagemin" target="_blank" rel="noreferrer noopener nofollow">here</a>.</p>



<p>The first step to using Imagemin after installing Node.js is to install the packages that we are going to use.</p>



<p>Now, create a Folder for optimizing images. </p>



<p>Open your command line terminal in this folder, -I use <a href="https://git-scm.com/downloads" target="_blank" rel="noreferrer noopener nofollow">Gitbash</a>&#8211; then run the following command</p>



<div class="hcb_wrap"><pre class="prism off-numbers lang-bash" data-lang="Bash" data-show-lang="1"><code>npm install imagemin imageminJpegtran imageminPngquant imageminWebp</code></pre></div>



<p>Or you can replace npm install with yarn add if you have yarn in your system.</p>



<div class="hcb_wrap"><pre class="prism off-numbers lang-bash" data-lang="Bash" data-show-lang="1"><code>yarn add imagemin imageminJpegtran imageminPngquant imageminWebp</code></pre></div>



<p>It will take a minute to finish installing the packages, and there should be [<strong>node_modules</strong>]folder.</p>



<p>Now we will create a file (<strong><em>index.mjs</em></strong>) to write up our code for optimizing images.</p>



<p>1- Include the packages</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-js" data-lang="JavaScript" data-show-lang="1"><code>import  imagemin from &#39;imagemin&#39;;
import  imageminJpegtran from &#39;imagemin-jpegtran&#39;;
import  imageminPngquant from &#39;imagemin-pngquant&#39;;
import imageminWebp from &#39;imagemin-webp&#39;;</code></pre></div>



<p>2- Add code for optimizing the images</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-js" data-lang="JavaScript" data-show-lang="1"><code>(async () =&gt; {
	const files =  await imagemin([&#39;images/*.{jpg,png}&#39;], {
		destination: &#39;output&#39;,
		plugins: [
			imageminWebp(
				{
					quality: 80,
				}
			)
		]
	});

    console.log(files);
    console.log(&#39;Images optimized&#39;);
})();
</code></pre></div>



<p>3- Create a folder inside the same directory named (<strong><em>images</em></strong>) which will include your original images.</p>



<p>4- Save the file and then from the terminal run the following command</p>



<div class="hcb_wrap"><pre class="prism off-numbers lang-bash" data-lang="Bash" data-show-lang="1"><code>node index.mjs</code></pre></div>



<p>5- New folder named (<strong><em>output</em></strong>) should appear -as per our code you can change it from the <strong>destination </strong>&#8211; containing the optimized images which will be formatted <strong>WebP</strong>.</p>



<p>If you want to use the Code we use for our optimizing Image on Imagemin you can find the code <a href="https://github.com/mohammedrezq/wadi-imagemin" target="_blank" rel="noreferrer noopener nofollow">here</a>.</p>



<h2 class="wp-block-heading">Testing Optimizing Images</h2>



<p>Now that you&#8217;re familiar with how to optimize images using <strong>Imagemin</strong>. I will display some results Before and After optimizing my images on one of my pages.</p>



<p><a href="https://www.wadiweb.com/wadi-gallery-grid-widget-for-elementor/" target="_blank" rel="noreferrer noopener"><strong>Wadi Gallery Grid for Elementor Page</strong></a> is basically a page full of images and videos so having optimized images is a necessity.</p>



<h2 class="wp-block-heading">Before Optimizing Images Results</h2>



<p>Using tools.pingdom.com here are the page results <strong>before</strong> images optimization</p>



<figure class="wp-block-image size-full"><img decoding="async" src="https://cdn.wadiweb.com/wp-content/uploads/2022/09/10074847/wadi-gallery-grid-pingdom-results-1.webp" alt="" class="wp-image-3638"/><figcaption>Gallery Grid Page Results</figcaption></figure>



<p>Page size is 11.3 MB and Load time is 3.37 seconds.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="687" height="339" src="https://cdn.wadiweb.com/wp-content/uploads/2022/09/10074821/wadi-content-size-by-content-type.webp" alt="" class="wp-image-3636" srcset="https://cdn.wadiweb.com/wp-content/uploads/2022/09/10074821/wadi-content-size-by-content-type.webp 687w, https://cdn.wadiweb.com/wp-content/uploads/2022/09/10074821/wadi-content-size-by-content-type-300x148.webp 300w" sizes="(max-width: 687px) 100vw, 687px" /><figcaption>Content size by content type</figcaption></figure>



<p>Images size takes the lion&#8217;s share of the page size more than 90% percent of page size is images!. Images take 10.2 MB of the total page size. That is why image optimization is necessary for any modern website that relies on images to create appealing web pages.</p>



<h2 class="wp-block-heading">After Optimizing Image Results</h2>



<p>Now <strong>after </strong>doing the images optimization process using Imagemin and covert all images to WebP format here are the results</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="961" height="419" src="https://cdn.wadiweb.com/wp-content/uploads/2022/09/10083059/wadi-gallery-grid-pingdom-results-after.webp" alt="" class="wp-image-3736" srcset="https://cdn.wadiweb.com/wp-content/uploads/2022/09/10083059/wadi-gallery-grid-pingdom-results-after.webp 961w, https://cdn.wadiweb.com/wp-content/uploads/2022/09/10083059/wadi-gallery-grid-pingdom-results-after-300x131.webp 300w, https://cdn.wadiweb.com/wp-content/uploads/2022/09/10083059/wadi-gallery-grid-pingdom-results-after-768x335.webp 768w" sizes="(max-width: 961px) 100vw, 961px" /><figcaption>Gallery Grid Page Results After</figcaption></figure>



<p>As you can see the web page size dropped from 10.2 MB to 3.6 MB by just doing image optimization which doesn&#8217;t take more than 5 minutes after the initial setup of <strong><em>Imagemin</em></strong>!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="696" height="300" src="https://cdn.wadiweb.com/wp-content/uploads/2022/09/10083057/wadi-content-size-by-content-type-after.webp" alt="" class="wp-image-3735" srcset="https://cdn.wadiweb.com/wp-content/uploads/2022/09/10083057/wadi-content-size-by-content-type-after.webp 696w, https://cdn.wadiweb.com/wp-content/uploads/2022/09/10083057/wadi-content-size-by-content-type-after-300x129.webp 300w" sizes="(max-width: 696px) 100vw, 696px" /><figcaption>Content size by content type After</figcaption></figure>



<p>Images now take about 72% of the web page size from more than 90% of the page size before images optimization &#8211; considering that Gallery Grid for Elementor demo page is a gallery for media images and videos I think it is very reasonable- that is a good improvement on a web page.</p>



<h2 class="wp-block-heading">Conclusion</h2>



<p>As you can see, image optimization for web pages is a necessity for every aspect of your website, whether to have a faster page for your users or better SEO that will help your web pages to rank on Search.</p>
<p>The post <a href="https://www.wadiweb.com/how-to-optimizie-images-for-your-website/">How to Optimize Images For Your Website</a> appeared first on <a href="https://www.wadiweb.com">Wadiweb</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
