Extension:VipsScaler

This page is a translated version of the page Extension:VipsScaler and the translation is 75% complete.
Other languages:
English • ‎中文 • ‎日本語
MediaWiki 拡張機能マニュアル
OOjs UI icon advanced.svg
VipsScaler
リリースの状態: 安定
Screenshot of VipsScaler extension.png
実装 メディア
説明 Allows to scale PNG and JPEG images using VIPS
作者 Bryan Tong Minh (Bryantalk)
MediaWiki 1.19+
データベースの変更 いいえ
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード
README
  • $wgVipsCommand
  • $wgVipsOptions
vipsscaler-test
translatewiki.net で翻訳を利用できる場合は、VipsScaler 拡張機能の翻訳にご協力ください
使用状況とバージョン マトリクスを確認してください。
問題点 未解決のタスク · バグを報告

The VipsScaler extension is a wrapper around VIPS, a free image processing software. 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のインストール

Install VIPS. It can be downloaded from http://www.vips.ecs.soton.ac.uk/.

After downloading VipsScaler, add it to your extensions/ directory, then add require_once("$IP/extensions/VipsScaler/VipsScaler.php"); If you'd like to add the Special:VipsTest test page, also add require_once("$IP/extensions/VipsScaler/VipsTest.php");

Debian / Ubuntu

$ apt-get install libvips-tools

If you want to build from source have a look at upstream documentation: http://www.vips.ecs.soton.ac.uk/index.php?title=Build_on_Ubuntu

(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

設定

$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',
    ],
  ],
];