Page MenuHomePhabricator

Option to Smush.it on image upload
Closed, DeclinedPublic

Description

Yahoo!'s Smush.it feature is a lossless image optimization. If you dunno it, read here http://developer.yahoo.com/yslow/smushit/
The API is

  • optimizing JPEG compression
  • converting certain GIFs to indexed PNGs
  • stripping the un-used colours from indexed images
  • meta data is NOT stripped from JPEGs

Adding this has been discussed on WP with the main anti-argument that thumbs are not smushed and storage doesn't matter for WikiMedia. But that's not the point.
The point is to save 2-20% storage on original images. Not every wiki is Wikipedia and for some storage does matter. Same for the traffic on the wiki and from hotlinking images.

My request is to include the Smush.it API on Special:Upload.
The feature could be optional by adding a checkbox called "Smush.it".

A plugin for WordPress exists to give you an idea: http://wordpress.org/extend/plugins/wp-smushit/

I don't see any disadvantage, except that the upload process may take a 2-3 seconds longer.


Version: unspecified
Severity: enhancement

Details

Reference
bz26755

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:11 PM
bzimport set Reference to bz26755.
bzimport added a subscriber: Unknown Object (MLST).

No reason to use smush-it. just find the proper imagemagick commands and apply them, or create new imagemagick commands that do the same.

We don't want to have to depend on yahoo.com for something like this.

Fair enough. Will google for those imagemagick commands.

Not sure if you could make this into an extension (for those who did want to use it...)

MediaWiki generally prefers to accept input files in their exact original format, then create derivative files optimized for output (convert to web-friendly sizes & formats, strip giant EXIF thumbnails, etc).

To actually modify the original file on upload, you'd probably want to do it pretty early in the upload process, so you're not worrying about for instance accidentally changing the file after a SHA-1 checksum has been generated.

The 'UploadVerifyFile' hook might actually be an ok place to rig something up, though it might not be ideal. (Disclaimer: I haven't tried it.)

Bryan.TongMinh wrote:

(In reply to comment #4)

The 'UploadVerifyFile' hook might actually be an ok place to rig something up,
though it might not be ideal. (Disclaimer: I haven't tried it.)

It needs a new hook I think. Something that is called just after fetchFile().

Assigning to subfader@gmail.com so he can respond with whatever his findings are.

Not much I found out. Except strip there are no other imagemagick options you can easily use on the fly without checking the image with a script.

The main advantage of the smush.it API is, that you don't to care about all that (nor in the future). The image you receive is losslessly optimized to the max while keeping metadata for JPEGs.

Thumbs generated by with imagemagick don't save much filesize when you smush them. Except PNG thumbs of course, but that's the compromize for having it resized on the fly.

But I talk about saving webspace and traffic for the originally uploaded images. Thus I can understand Brion's pov having the originals untouched. But not every wiki using MediaWiki is Wikipedia... (I love that argument).

So, I'd love to have an option to smuch images on upload, but can understand if no dev wants to implent it since most devs only code what is good for WP.

This would probably be much better as a extension that hooked into MW, re product-ing and component-ing as such.

I gave up using Smush.it cos it's not worth the effort the manual way.

Also I came across a few bad results (like 1 in 100) where color layers (dunno what they're called) were removed in PNGs.

Also I agree it may be better as extension.

Someone feel free to close this as WONTFIX.