I'm fairly sure Moodle user images used to be JPEGs, but now they seem to be PNGs. Does anyone know when and why this change happened?
Here on Moodle.org you can use the 3rd party service Gravatar which provides the user images as JPEGs. As a result some user's images from that service are 10x smaller than others provided by Moodle itself. (It also resizes the image as required, so when displayed at 60x60 it will provide a 60x60 image, not a larger one and then resize it in the browser).
Modern web design trends often emphasis the use of large user images to inspire users to interact with each other. Moodle seems to be anticipating this by introducing a new user icon size of f3 at 512x512px, but since these are PNGs, they are about 500K in size, which I think makes them basically unusable.
I think some users that have been around for a while and not changed their avatar still have JPEGs, in case that confuses anyone looking into this.
But has anyone else investigated this before? I'm thinking a shift back to JPEG would make a lot of sense, and allow us to use visually larger yet faster to download images but wanted to do some more research first to find out why the opposite switch was made in the past.
After a bit of spelunking I found this commit message:
MDL-11000 finally switching to png images with jpg fallback, based on code by Luigi Pinca
Checking out that bug it seems that defaulting to PNG images was done as a side affect of fixing other issues. As Mary mentioned it was due to alpha being handled poorly compared with Mahara.
Since we already have the facility to do both I quite like the idea suggested in the bug of using JPEG if the user uploads a JPEG and PNG if the user uploads a PNG, seems like we'd get the best of all worlds then.
Might look at dropping the default quality from 90 too, though it depends on how good the GD implementation is.
MDL-11000 finally switching to png images with jpg fallback, based on code by Luigi Pinca
Checking out that bug it seems that defaulting to PNG images was done as a side affect of fixing other issues. As Mary mentioned it was due to alpha being handled poorly compared with Mahara.
Since we already have the facility to do both I quite like the idea suggested in the bug of using JPEG if the user uploads a JPEG and PNG if the user uploads a PNG, seems like we'd get the best of all worlds then.
Might look at dropping the default quality from 90 too, though it depends on how good the GD implementation is.
Yeah, mine isn't a gravatar, it's uploaded directly into Moodle.
As is Gareth's:
https://moodle.org/user/view.php?id=442195&course=5
Both of our user icon suit being PNG though as they are blocks of flat color.
Stuart's is a "photographic" image and therefore would be best as a JPEG. It too is a PNG though:
https://moodle.org/user/view.php?id=1058627&course=5
The default Gravatar mm image is very similar to the Moodle default one. It seems if you have Gravatar support turned on then Moodle has no way to know if your have an image uploaded or not, so it gets a Gravatar default image instead.
But on Moodle installs without Gravatars turned on, the default f1 image is a png. (Though should probably be switched to an SVG for both crisper lines and smaller file size).
As is Gareth's:
https://moodle.org/user/view.php?id=442195&course=5
Both of our user icon suit being PNG though as they are blocks of flat color.
Stuart's is a "photographic" image and therefore would be best as a JPEG. It too is a PNG though:
https://moodle.org/user/view.php?id=1058627&course=5
The default Gravatar mm image is very similar to the Moodle default one. It seems if you have Gravatar support turned on then Moodle has no way to know if your have an image uploaded or not, so it gets a Gravatar default image instead.
But on Moodle installs without Gravatars turned on, the default f1 image is a png. (Though should probably be switched to an SVG for both crisper lines and smaller file size).