Extension:VipsScaler: Difference between revisions
Appearance
Content deleted Content added
I you want to do it this way you probably know what you are doing. |
rework a bit |
||
Line 29: | Line 29: | ||
<translate> |
<translate> |
||
== |
== == <!--T:2--> |
||
=== |
=== VIPS === <!--T:5--> |
||
<!--T:6--> |
<!--T:6--> |
||
Line 51: | Line 51: | ||
<translate> |
<translate> |
||
=== |
=== VipsScaler extension === <!--T:10--> |
||
</translate> |
</translate> |
||
{{ExtensionInstall |
{{ExtensionInstall |
||
| registration = required |
| registration = required |
||
| custom-steps0 = * Install VIPS |
| custom-steps0 = * Install VIPS |
||
| custom-steps = |
|||
⚫ | |||
* [[#Confinguration|<translate>Configure as required.</translate>]] |
|||
⚫ | |||
}} |
}} |
||
<translate> |
<translate> |
||
== Configuration == <!--T:4--> |
== Configuration == <!--T:4--> |
||
</translate> |
</translate> |
||
; $wgVipsCommand |
; $wgVipsCommand |
||
: <translate><!--T:11--> path to the vips command (default: vips).</translate> |
: <translate><!--T:11--> path to the vips command (default: vips).</translate> |
||
; $wgVipsOptions |
; $wgVipsOptions |
||
: <translate><!--T:12--> Options and conditions for images to be scaled with this scaler.</translate> <translate><!--T:13--> 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.</translate> <translate><!--T:14--> Conditions are <tvar name=1>mimeType</tvar>, <tvar name=2>minArea</tvar>, <tvar name=3>maxArea</tvar>, <tvar name=4>minShrinkFactor</tvar>, <tvar name=5>maxShrinkFactor</tvar>.</translate> <translate><!--T:15--> The other items in the array are options.</translate> <translate><!--T:16--> Options available are:</translate> |
: <translate><!--T:12--> Options and conditions for images to be scaled with this scaler.</translate> <translate><!--T:13--> 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.</translate> <translate><!--T:14--> Conditions are <tvar name=1>mimeType</tvar>, <tvar name=2>minArea</tvar>, <tvar name=3>maxArea</tvar>, <tvar name=4>minShrinkFactor</tvar>, <tvar name=5>maxShrinkFactor</tvar>.</translate> <translate><!--T:15--> The other items in the array are options.</translate> <translate><!--T:16--> Options available are:</translate> |
||
* sharpen - Set to an array with keys 'radius' and 'sigma', which are parameters to gaussian sharpen matrix. |
* sharpen - Set to an array with keys 'radius' and 'sigma', which are parameters to gaussian sharpen matrix. |
Revision as of 15:40, 1 November 2024
Please expand this page. |
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 | 8 (Ranked 117th) |
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. It can be configured to scale only certain files (for example: big PNGs) by configuring $wgVipsOptions.
Installation
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
- 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.
- Navigate to "Special:VipsTest" to verify it is working and see the difference in output quality.
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Configuration
$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',
],
],
];
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. |