Jeavon / Slimsy

Effortless Responsive & Lazy Images with LazySizes and Umbraco
MIT License
72 stars 23 forks source link

Add the possibility of changing webp quality #53

Closed julieteg closed 1 year ago

julieteg commented 1 year ago

Please, add the possibility of changing the webp quality in the SlimsyPictureTagHelper.

Today it's fixed on 70% in the code and we wanted to use a custom value there.

Jeavon commented 1 year ago

@julieteg Yes, we will do that. In v4.1 we've made a bit more configurable to support multiple formats, in the example below might you want to set the quality to be different for webp and avif or should it be a single setting do you think?

  "Slimsy": {
    "WidthStep": 180,
    "UseCropAsSrc": false,
    "DefaultQuality": 70,
    "Format": "",
    "BGColor": "",
    "TagHelper": {
      "SingleSources": [ "gif" ],
      "PictureSources": [ "webp", "avif" ]
    }
  }
julieteg commented 1 year ago

I think you can give us the option of setting the quality of Webp and Avif separately :)

Jeavon commented 1 year ago

@julieteg Yes, for defaults, we put this together

  "Slimsy": {
    "WidthStep": 180,
    "UseCropAsSrc": false,
    "DefaultQuality": 70,
    "Format": "",
    "BGColor": "",
    "TagHelper": {
      "SingleSources": [ "gif" ],
      "DefaultPictureSources": [
        {
          "Extension": "webp",
          "Quality": "90"
        },
        {
          "Extension": "avif",
          "Quality":  "100"
        }
      ]
    }
  }

But I also think that you might have a specific usage where you want to boost the quality so I'm going to look at adding a parameter to the tag helper also