Developer forum

Forum » Swift » Swift - Images is compressed too much

Swift - Images is compressed too much

Marie Louise Veigert
Reply

Hi,

We are experiencing that images are compressed too much regarding SEO in Swift.
I can see the imagehandler is behind the rendering and have the options to scale the image to devices.

The end goal is the get the resolution up.

Im sitting on a laptop with large screen and still only get the small image.

Are there a setting to prevent this from happening?

This is the setup with the 'Poster paragraph':



I have tried to play around with the "original", "small", "medium", "large" etc, but then they doesn't fit the layout.

The image used have this size when uploading - is this an issue ?

 

I know there is something with performance as well to this, but would like it to be optimized more :)


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Marie Louise

Can you explain a bit more? Is it compression or resolution that you struggle with?

Can you show it?

BR Nicolai

 
Marie Louise Veigert
Reply

My colleague have specified a bit :) 

"When our client uploads images around 1000KB and then when you save them from the website similar as Google does when crawling, they are way smaller, around 35KB, and drop quality. How can we make the compression less and keep the image in good quality and not effect the design layout of the site?

SEO best practices is to upload images around 100-200KB, which our client does but then they drop in size when being optimized."

 
Marie Louise Veigert
Reply

Any suggestions?  :)

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Swift uses webp for most images - and they are handled by the image component as you can se here:

https://github.com/dynamicweb/Swift/blob/main/Swift/Files/Templates/Designs/Swift/Components/Image.cshtml#L50

Default webp quality is 50 - compressed to secure performance which is very important for conversions on mobile and for good Lighthouse scores also important for SEO purposes.

You can easily change quality of the images with a small change to the image component - add quality paramter to increase sharpness and image size:

Change these lines - here trying 90 in quality:

string imagePathM = $"/Admin/Public/GetImage.ashx?image={imagePath}&width=640&format=webp&quality=90";
string imagePathL = $"/Admin/Public/GetImage.ashx?image={imagePath}&width=960&format=webp&quality=90";
string imagePathXL = $"/Admin/Public/GetImage.ashx?image={imagePath}&width=1280&format=webp&quality=90";
string imagePathXXL = $"/Admin/Public/GetImage.ashx?image={imagePath}&width=1920&format=webp&quality=90";

You can also say 100 causing larger images - or -1 for "lossless webp" quality.

You can also change from webp format to jpeg format which in some cases can be a better option if you prefer large photos with less quality loss over performance.

Documentation of the GetImage handler:

https://doc.dynamicweb.com/documentation-9/platform/platform-tools/getimage-image-handler

BR Nicolai

Votes for this answer: 2
 
Tomas Vasiliūnas
Reply

Hello,

Since Swift version 1.22 a new setting regarding image quality was introduced "Support image quality setting from backend administration", however I can't find it anywhere.

Could someone please specify where to find it?

Thanks

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

It is a DW setting and you can find it here:

9.16 that comes in a minute also contains the option to use another imageresize provider (ImageSharp instead of ImageGlue)

Votes for this answer: 1

 

You must be logged in to post in the forum