Jump to content

Extension:VipsScaler

From mediawiki.org
This page is a translated version of the page Extension:VipsScaler and the translation is 14% complete.
MediaWiki 拡張機能マニュアル
VipsScaler
リリースの状態: 安定
実装 メディア
説明 Allows to scale PNG and JPEG images using VIPS
作者 Bryan Tong Minh (Bryanトーク)
MediaWiki 1.19+
データベースの変更 いいえ
ライセンス GNU 一般公衆利用許諾書 2.0 以降
ダウンロード
README
  • $wgVipsCommand
  • $wgVipsOptions
  • $wgVipsTestExpiry
  • $wgVipsExposeTestPage
  • $wgVipsThumbnailerHost
  • vipsscaler-test
四半期ごとのダウンロード数 9 (Ranked 131st)
使用中の公開ウィキ 1,811 (Ranked 203rd)
translatewiki.net で翻訳を利用できる場合は、VipsScaler 拡張機能の翻訳にご協力ください
問題点 未解決のタスク · バグを報告

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).

インストール

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

Mac OS X

$ brew install homebrew/science/vips
$ binary symlink is /usr/local/bin/vips

VipsScaler extension


  • Install VIPS
  • ダウンロードして、ファイルをextensions/フォルダー内のVipsScalerという名前のディレクトリ内に配置します。
    開発者とコード寄稿者は、上記の代わりに以下を使用してGitからインストールします:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/VipsScaler
  • 以下のコードを LocalSettings.php ファイルの末尾に追加します:
    wfLoadExtension( 'VipsScaler' );
    
  • Configure as required.
  • Yes 完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。

設定

$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 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.
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).