Page MenuHomePhabricator

Add basic WebP upload support with JPEG/PNG thumbnails
Closed, ResolvedPublic

Description

To support upload of WebP images on Commons (bug 25397) we'll want to do basic JPEG or PNG thumbnail conversion.

In the future this can be fancied up to serve WebP thumbs to supporting browsers, but for the near term this would allow uploading WebP source images and having them be usable on the site.

Probably can convert with ImageMagick... if not can use other tools easily.


Version: 1.22.0
Severity: enhancement

Details

Reference
bz48519

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:39 AM
bzimport set Reference to bz48519.

r75087 added file type recognition, not sure if anybody's stuck size fetching or thumbnailing in since...

This would be simplest using ImageMagick, but note that the standard Ubuntu build of IM doesn't seem to include webp support. Nice.

May have to deal with dependencies... sigh.

FWIW, it seems to work here just fine with standard Ubuntu build?

Setting up imagemagick (8:6.6.9.7-5ubuntu3.2) ...
igrigorik@igrigorik:~$ convert -version
Version: ImageMagick 6.6.9-7 2012-08-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP

igrigorik@igrigorik:~$ convert bugzilla-logo.png -quality 50 -define webp:lossless=true logo.webp

igrigorik@igrigorik:~$ ls -alh logo.webp
-rw-r----- 1 igrigorik eng 11K Nov 7 14:53 logo.webp

Bryan.TongMinh wrote:

I have some WebP detection magic.

Change 95872 had a related patch set uploaded by btongminh:
(bug 48519) Basic support for WebP

https://gerrit.wikimedia.org/r/95872

What is the behavior when the thumbnail is larger than the image file? Does the webp get delivered without conversion to JPEG?

Example:

  1. image.webp with resolution 400*300 gets uploaded to Commons
  2. An en-wiki-user embedds the file with [[image.webp|900px]]

(In reply to comment #6)

What is the behavior when the thumbnail is larger than the image file? Does
the
webp get delivered without conversion to JPEG?

Example:

  1. image.webp with resolution 400*300 gets uploaded to Commons
  2. An en-wiki-user embedds the file with [[image.webp|900px]]

It should output a jpeg thumbnail that is 400px wide (Never outputting the original file is controlled by the mustRender() method. For webP this is always set to true. Not outputting thumb greater than source width is controlled by isVectorized().)

Change 95872 had a related patch set uploaded (by TheDJ):
Basic support for WebP

https://gerrit.wikimedia.org/r/95872

Change 95872 merged by jenkins-bot:
Basic support for WebP

https://gerrit.wikimedia.org/r/95872