Extension:VipsScaler
VipsScaler Release status: stable |
|
---|---|
Implementation | Media |
Description | Allows to scale PNG and JPEG images using VIPS |
Author(s) | Bryan Tong Minh (Bryantalk) |
MediaWiki | 1.19+ |
Database changes | No |
License | GNU General Public License 2.0 or later |
Download | README |
|
|
|
|
Quarterly downloads | 15 (Ranked 115th) |
Public wikis using | 1,811 (Ranked 203rd) |
Translate the VipsScaler extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
The VipsScaler extension creates JPG and PNG thumbnails faster and at low memory usage. The extension replaces MediaWiki core's Media handlers for bitmaps, which default to ImageMagick. It is powered by the free image processing software VIPS, which speeds up resizing of large PNGs, and it improves the appearance of shrunken JPEGs.
The extension shells out to the VIPS binary. By configuring $wgVipsOptions
, it can be configured to scale only certain files (for example, big PNG files).
Installation
editVIPS
editInstall VIPS. It can be downloaded from https://libvips.github.io/libvips or your OS repository (see below).
Debian / Ubuntu
edit$ apt-get install libvips-tools
Mac OS X
edit$ brew install homebrew/science/vips
$ binary symlink is /usr/local/bin/vips
VipsScaler extension
edit- Install VIPS
- Download and move the extracted
VipsScaler
folder to yourextensions/
directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/VipsScaler - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'VipsScaler' );
- Configure as required.
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Configuration
edit$wgVipsCommand
- Path to the "vips" command (default:
/usr/bin/vips
).
$wgVipsOptions
- Options and conditions to scale images with this scaler (default: empty). Set to an array of arrays. The inner array contains a condition array, which contains a list of conditions the image should pass for it to be scaled with VIPS. Conditions are
mimeType
, minArea,maxArea
,minShrinkFactor
,maxShrinkFactor
. The other items in the array are options. Options available are:
sharpen
- Set to an array with keys 'radius' and 'sigma', parameters to the Gaussian sharpen matrix.preconvert
- Convert the file to a .v file first, which costs some space but saves memory on the actual downsizebilinear
- Use im_resize_linear instead of im_shrinkconvolution
- Apply specified convolution matrixsetcomment
- Add an EXIF comment specifying the source of the file. Requires$wgExiv2Command
to be set properly.
- Example
$wgVipsOptions = [ // Sharpen jpeg files which are shrunk more than 1.2 [ 'conditions' => [ 'mimeType' => 'image/jpeg', 'minShrinkFactor' => 1.2, ], 'sharpen' => [ 'radius' => 0, 'sigma' => 0.8 ], ], // Other jpeg files [ 'conditions' =>[ 'mimeType' => 'image/jpeg', ], 'sharpen' => false, 'bilinear' => true, ], // Do a simple shrink for PNGs [ 'conditions' => [ 'mimeType' => 'image/png', ], ], ];
$wgVipsExposeTestPage
- Allow testing via "Special:VipsTest", which lets you verify it is working and see the difference in output quality. (default:
false
).
See also
edit- Extension:Thumbro - Forked and rewritten version of this extension
This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page. |