Even with running media:clear every day as a cronjob, after 3 months of use toot.cafe is using up 27.6GB in public/system/media_attachments. It would be nice to have another rake task, let's say media:optimize, to run mozjpeg and zopfli-png over those images to shrink their size down a bit.
zopfli-png is non-destructive, but mozjpeg can reduce the quality of the original image. So ideally there'd be some reasonable default quality (mozjpeg seems to recommend 75) and then admins could also pass in a parameter to change it.
master (If you're a user, don't worry about this).Alternatively, maybe this should be an automatic operation when an image is uploaded, since it's also a performance improvement that improves transfer times, and would benefit those using cloud storage providers as well.
Image quality issues aside, wouldn't making the files smaller only postpone the problem for a short time?
reducing file sizes is, admittedly, not the panacea regarding disk space taken by uploaded media, but it helps both the users and the admins, and it doesn't cost much.
Automatic conversion of any image to low-quality jpeg is one of the things people keep cursing birdsite for.
Mastodon already turns animated gif into mpeg (much smaller, but bad for pixel artists). Please don't start turning png into jpeg too.
Compressing png as far as possible is okay of course. And maybe jpeg can be compressed a little further (though not as much as birdsite please)
optimizing media doesn't mean turning everything into trash like twitter does yeah. If we do this we should definitely keep a good quality.
There might be some tools that do advanced stuff but as far as ffmpeg/imagemagick go we're maxed out imo.
Fair enough, maybe at some point though it'd be nice to have hooks to add extra minifiers (mozjpeg, zopfli-png) and/or dial down the quality a bit.