An automatic image optimizer for the Sitecore media library. Reduce the size of your images served from Sitecore by 8-70%, completely automatically.
When media images are requested, Dianoga automatically runs mozjpeg, PNGOptimizer, SVGO or WebP on the image data immediately after it is placed in the Sitecore media cache.
Dianoga ensures that your site is always serving fully optimised media library images even if you are using Sitecore’s dynamic resizing features. Even if you have already optimized every image uploaded into the media library, after Sitecore performs image processing the result is not optimized (an unfortunate limitation of most other image optimization libraries for Sitecore is that they only apply to the original image).
Dianoga is also great for situations where content editors may not be image editing experts and upload images that contain gobs of EXIF data and other nonessential metadata - these are removed automatically before being shown to visitors.
Create a project in your Helix solution, preferably in the Feature layer for Dianoga.
Install the latest release of the Dianoga NuGet Package over the Feature project.
The installation will add the required files to the Project.
Now, Publish the project to your Sitecore Instance.
Open the path Sitecore-webroot/App_Data/MediaCache in File Explorer and empty that folder.
Restart your Sitecore instance on IIS.
Dianoga should now be configured on your site.
Open your latest log file and you should find an entry similar to this:
2816 19:50:28 INFO Dianoga: Installed optimizing media cache to provide async optimization with max 1 concurrent threads.
The above log entry will ensure that Dianoga is up and running on your site.
Now, try loading your site and you will notice the difference.
You can find my solution with Dianoga installed here.
https://github.com/mrvinaykj/sitecore-92-base
If you are using PackageReference as a way in maintaining the NuGet packages for your solution, then the required files will not be installed on the project.
You can either install the package over the project and then switch to PackageReference for the project.
Or,
Clone the repository: https://github.com/kamsar/Dianoga
From the src/Dianoga folder:
You will need to include the below DLLs to be deployed along with your project.