We are making use of the image derivative function in combination with setting the default image quality to get optimized responsive images.
It seems that this default image quality gets only applied to the derivatives which are created and not to the original image is that correct?
If yes this is quite problematic because due to the image quality we are telling our content editors they dont need to care about compressing images when uploading. Therefore in case of a device is requesting the original image (because no smaller derivative is sufficient) the device will get a uncompressed image.
Is there a way to fix that?
Hi, you could use the " Page Media Image Resizer" in the admin plugin control panel. You’ll find it either under “extras” if you’re using Grav 1.7 or at the bottom of the Admin plugin control panel in 1.6.
you can set the default resize there - so that even if your clients upload an 8mb image it will be resized to, let’s say 1440px.
Thanks for your suggestion but that does not solve the problem. The image resolution is not the problem because we are creating the smaller derivatives and use them with srcset. But even if using the correct image resolution we still could save a lot by compressing the image which is as said working fine for the derivatives but not for the original.
In that case I don’t understand the problem: what would you like the system to do? The Admin plugin will resize the image so your content editors don’t have to, the derivatives will resize based on media queries - so you just need the admin resize to make sure the original image isn’t ludicrously large.
What’s your desired outcome?
I created a screenshot with a markup example from our website and tried to describe what i want to achieve. I hope it gets more clear now. So the global image quality setting should be applied to the original image.
The only workaround i can think of is to urge the content editors to upload images which are at least one derivative step larger than the largest image ever needed. But that only works for new content as it would be very much effort to change all the existing images.
Hi @sque, I understand now. I’m not sure how to get round this. My personal approach would be to have a consistent quality for uploads and derivatives and rely on the size change to deliver the data savings.
For example, choose 75% as an acceptable, across the board, compression level. Then upload the original with 75% compression and set the admin compression to the same level - this will also give you a consistent standard of image quality. But it may not be right for what you’re looking for.
Thank you very much for your time looking at this! I also tend to think that there is currently no solution for it. Your suggestion is good if only view people are managing the page but we got a lot of people working with it and i think it will not work that everybody is taking care of saving the images properly.
From plugin perspective i would assume that if i want to make use of this default jpg compression than also the original image should be regenerated into the cache with this setting and be used everywhere the original image would be used.
But that s a feature request (or bug) in the repo.
well, I am new to GRAV, but there are two quality settings:
- within configuration -> system -> media -> default image quality
- within plugins -> admin panel -> page media image resizer -> resize quality
The first one is - in my opinion - for creating compressed derivates of the original image. The second one is for compressing the original image while uploading it as a pages mediafile.
So, if you want to compress the original to 60 % you could set it to 0,6 within the configs of the admin panel.
I uploaded an image (original 479KB) with the following settings made in admin panel:
a) no resizing, image quality 0,9 -> 490KB
b) no resizing, image quality 0,2 -> 256KB
So it seems you do not have to do this:
The only workaround i can think of is to urge the content editors to upload images which are at least one derivative step larger than the largest image ever needed.
Indeed, this will of course not change that issue
But that only works for new content as it would be very much effort to change all the existing images.
this is awesome, how could i oversee that. This perfectly solves the issue. Thank you very much for pointing that out!