Wikimedia Blog/Drafts/VipsScaler

Title

edit

VipsScaler implementation by volunteer developer improves image handling on Wikimedia sites

Body

edit
 
A depiction of the Battle of Belmont, Second Boer War. This image is an example of image reduction in VipsScaler. The original file has a resolution of 52 megapixels

Loading and resizing large images within Wikimedia projects has became faster and more reliable with the rollout of VipsScaler, a wraparound to the VIPS free image processing software. VIPS is a tool designed to use a small amount of memory when resizing images. This allows the wiki to create thumbnails of very large PNG files; something which previously was not possible because large amounts of memory would be required. And while Wikimedia Foundation technical staff rolled it out, a volunteer wrote the code.

The most common type of image file on the internet is a JPEG, but since its compression leads to deteriorated image quality with repeated editing, most Wikipedia and Commons non-photographic image files are stored in PNG formats, since it uses lossless compression. Until VipsScaler, thumbnails of PNG files larger than 50 megapixels could not be created.

Volunteer Bryan Tong Minh was a student at Delft University of Technology in 2008 when he initially wrote a utility capable of downscaling PNG images without using huge amounts of memory. Active on Wikimedia Commons at the time, Tong Minh (User:Bryan) said he "was annoyed by the fact that large PNGs did not have thumbnails because the image scaler that we used, ImageMagick, could not efficiently scale large non-JPEG images."

During the review period of the utility, he became aware of VIPS, which allows for memory-efficient scaling of image files -- more than just PNGs. He then set out to implement an extension that would allow usage of VIPS with MediaWiki, which became the VipsScaler extension.

"For many years, PNG files over a certain size could not be displayed on Wikipedia. They could be downloaded, but gave an error when thumbnailed and, on their file page, made it appear that the file was corrupt," said Adam Cuerden, whose restoration work on Wikipedia since 2007 accounts for four percent of all featured pictures on English Wikipedia. Cuerden says it wasn't uncommon for PNG files to be marked for deletion because they could not be displayed.

Currently, VIPS scales PNG images from 35 to 140 megapixels, according to Commons contributor Brian Wolff. He points to this 72 megapixel image restored by Adam Cuerden as an example of an image that previously wouldn't have been able to be rendered:

 
U.S. Presidential Candidate Abraham Lincoln (1860), lithograph by Leopold Grozelier. (Original resolution of 62 megapixels)

Wolff hopes eventually to be able to render TIFF images over 50 megapixels, as this is the format of many museum images. VipsScaler allows those museum large-size PNG files to be thumbnailed now.

"We originally planned deployment of VipsScaler in 2011," said Tong Minh. "However, when testing the extension, it became apparent that the memory-scaling method that was the goal of implementing VipsScaler was not usable with PNGs. Fortunately by that time, the main developer of VIPS had become aware of our intentions to deploy VIPS on Wikimedia, and he implemented this efficient scaling method, which was the final obstacle to deployment of VIPS."

 
A high resolution (83 megapixel) satellite photo of Corsica.

This effort could not have succeeded without the upstream efforts of John Cupitt, the VIPS developer who improved its scaling capabilities.

Initially from the Netherlands, Tong Minh said he first found Wikipedia and the Wikimedia Foundation while "looking up information on Wikipedia back in 2006." He previously wrote the GlobalUsage extension, which allows users to see which projects a Commons image is in use on, and he has made what he describes as "major and minor contributions to the MediaWiki core."

Tong Minh believes that the 50 megapixels area limit for TIFF images will eventually be removed once TIFF scaling is moved to VIPS as well. "That should be nice for Wiki Loves Monuments," said Sumana Harihareswara, Engineering Community Manager at the Wikimedia Foundation. [1]. According to Harihareswara, there might be slight changes in visual quality and a few images might break.

Tong Minh said he hopes to have the opportunity to work on something "media related" in the future. As for the time it's taken to reach deployment he wasn't surprised. He said he recognizes that contributions are by volunteers and it can take "a lot of time to build up momentum. But when the momentum is there, eventually people are always very helpful in making the final push."

Donna Peterson
Wikimedia Foundation Communications volunteer

Notes

edit