Extension:VipsScaler/zh
VipsScaler 发行状态: 稳定版 |
|
---|---|
实现 | 媒体 |
描述 | Allows to scale PNG and JPEG images using VIPS |
作者 | Bryan Tong Minh (Bryan留言) |
MediaWiki | 1.19+ |
数据库更改 | 否 |
许可协议 | GNU通用公眾授權條款2.0或更新版本 |
下載 | README |
|
|
|
|
季度下載量 | 10 (Ranked 125th) |
正在使用的公开wiki数 | 1,811 (Ranked 203rd) |
前往translatewiki.net翻譯VipsScaler扩展 | |
問題 | 开启的任务 · 报告错误 |
The VipsScaler extension is a wrapper around the free image processing software VIPS. VIPS is a set of image manipulation tools specially designed for speed and low memory usage. This is useful for resizing large PNGs, and it improves the appearance of shrunken JPEGs.
The extension shells out to the vips binary. It can be configured to scale only certain files (for example: big PNGs) by configuring $wgVipsOptions.
VIPS installation
Install VIPS
Install VIPS. It can be downloaded from https://libvips.github.io/libvips or your OS repository (see below).
Debian / Ubuntu
$ apt-get install libvips-tools
If you want to build from source have a look at upstream documentation: https://libvips.github.io/libvips/install.html
(Wikimedia has packaged and uses a more recent version for Ubuntu 12.04 at apt.wikimedia.org)
Mac OS X
- homebrew
- brew install homebrew/science/vips
- binary symlink is /usr/local/bin/vips
Install VipsScaler extension
- Install VIPS (see above)
- 下载文件,并将解压后的
VipsScaler
文件夹移动到extensions/
目录中。
开发者和代码贡献人员应从Git安装扩展,输入:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/VipsScaler - 将下列代码放置在您的LocalSettings.php 的底部:
wfLoadExtension( 'VipsScaler' );
- Navigate to Special:VipsTest to verify it is working and see the difference in output quality.
- 完成 – 在您的wiki上导航至Special:Version,以验证已成功安装扩展。
配置
- $wgVipsCommand
- path to the vips command (default: vips).
- $wgVipsOptions
- Options and conditions for images to be scaled with this scaler. Set to an array of arrays. The inner array contains a condition array, which contains a list of conditions that 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', which are parameters to gaussian sharpen matrix.
- preconvert - Convert the file to a .v file first, which costs some space, but saves memory on the actual downsize
- bilinear - Use im_resize_linear instead of im_shrink
- convolution - Apply specified convolution matrix
- setcomment - Add an exif comment specifying the source of the file. Requires $wgExiv2Command to be set properly.
$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',
],
],
];
此扩展用于一个或多个维基媒体项目。 这可能意味着扩展足够稳定、运作足够良好,可以用在这样的高流量的网站上。 请在维基媒体的CommonSettings.php和InitialiseSettings.php配置文件中查找此扩展的名称以查看哪些网站安装了该扩展。 特定wiki上的已安装的扩展的完整列表位于Special:Version页面。 |