瀏覽代碼

Add pro features to docs

DarthSim 5 年之前
父節點
當前提交
321639799d

+ 6 - 0
docs/assets/pro.svg

@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="64" height="27" viewBox="0 0 64 27">
+    <svg fill="none" fill-rule="evenodd" x="5">
+        <rect width="53" height="26" x=".5" y=".5" stroke="#177BD3" rx="13"/>
+        <path fill="#177BD3" fill-rule="nonzero" d="M15.15 15.243V19h-2.198V8.336h4.16c.801 0 1.505.146 2.113.44.608.292 1.076.709 1.403 1.248.327.54.49 1.154.49 1.842 0 1.045-.357 1.87-1.072 2.472-.716.603-1.706.905-2.97.905h-1.927zm0-1.78h1.962c.581 0 1.024-.137 1.33-.41.305-.274.457-.664.457-1.172 0-.523-.153-.945-.461-1.267-.308-.322-.732-.489-1.274-.498h-2.015v3.347zm11.425 1.633h-1.75V19h-2.198V8.336h3.963c1.26 0 2.231.28 2.915.842.683.562 1.025 1.355 1.025 2.38 0 .728-.157 1.335-.472 1.82-.315.487-.792.873-1.432 1.162l2.307 4.357V19h-2.358l-2-3.904zm-1.75-1.78h1.772c.552 0 .98-.14 1.282-.42.303-.281.454-.668.454-1.162 0-.503-.143-.898-.428-1.186-.286-.288-.724-.432-1.315-.432h-1.765v3.2zm16.135.594c0 1.05-.186 1.97-.557 2.76-.37.792-.902 1.402-1.593 1.832-.69.43-1.483.644-2.376.644-.884 0-1.673-.212-2.366-.637-.693-.425-1.23-1.031-1.611-1.82-.381-.788-.574-1.695-.58-2.72v-.528c0-1.05.19-1.974.569-2.772.378-.799.913-1.411 1.604-1.839.69-.427 1.48-.64 2.369-.64.889 0 1.678.213 2.37.64.69.428 1.225 1.04 1.603 1.839.379.798.568 1.72.568 2.765v.476zm-2.227-.484c0-1.118-.2-1.968-.6-2.549-.4-.58-.972-.871-1.714-.871-.737 0-1.306.287-1.707.86-.4.574-.603 1.415-.608 2.524v.52c0 1.089.2 1.933.601 2.534.4.6.977.9 1.729.9.737 0 1.303-.289 1.699-.867.395-.579.596-1.422.6-2.53v-.52z"/>
+    </svg>
+</svg>

+ 5 - 0
docs/assets/style.css

@@ -73,3 +73,8 @@
     transform: rotate(360deg);
     transform: rotate(360deg);
   }
   }
 }
 }
+
+.pro-badge {
+  height: 1em;
+  vertical-align: middle;
+}

+ 27 - 3
docs/configuration.md

@@ -70,8 +70,30 @@ Also you may want imgproxy to respond with the same error message that it writes
 ## Compression
 ## Compression
 
 
 * `IMGPROXY_QUALITY`: default quality of the resulting image, percentage. Default: `80`;
 * `IMGPROXY_QUALITY`: default quality of the resulting image, percentage. Default: `80`;
-* `IMGPROXY_GZIP_COMPRESSION`: GZip compression level. Default: `5`;
-* `IMGPROXY_JPEG_PROGRESSIVE` : when true, enables progressive JPEG compression. Default: false;
+* `IMGPROXY_GZIP_COMPRESSION`: GZip compression level. Default: `5`.
+
+### Advanced JPEG compression
+
+* `IMGPROXY_JPEG_PROGRESSIVE`: when true, enables progressive JPEG compression. Default: false;
+* `IMGPROXY_JPEG_NO_SUBSAMPLE`: <img class="pro-badge" src="assets/pro.svg" alt="pro" /> when true, chrominance subsampling is disabled. This will improve quality at the cost of larger file size. Default: false;
+* `IMGPROXY_JPEG_TRELLIS_QUANT`: <img class="pro-badge" src="assets/pro.svg" alt="pro" /> when true, enables trellis quantisation for each 8x8 block. Reduces file size but increases compression time. Default: false;
+* `IMGPROXY_JPEG_OVERSHOOT_DERINGING`: <img class="pro-badge" src="assets/pro.svg" alt="pro" /> when true, enables overshooting of samples with extreme values. Overshooting may reduce ringing artifacts from compression, in particular in areas where black text appears on a white background. Default: false;
+* `IMGPROXY_JPEG_OPTIMIZE_SCANS`: <img class="pro-badge" src="assets/pro.svg" alt="pro" /> when true, split the spectrum of DCT coefficients into separate scans. Reduces file size but increases compression time. Requires `IMGPROXY_JPEG_PROGRESSIVE` to be true. Default: false;
+* `IMGPROXY_JPEG_QUANT_TABLE`: <img class="pro-badge" src="assets/pro.svg" alt="pro" /> quantization table to use. Supported values are:
+  * `0`: Table from JPEG Annex K (default);
+  * `1`: Flat table;
+  * `2`: Table tuned for MSSIM on Kodak image set;
+  * `3`: Table from ImageMagick by N. Robidoux;
+  * `4`: Table tuned for PSNR-HVS-M on Kodak image set;
+  * `5`: Table from Relevance of Human Vision to JPEG-DCT Compression (1992);
+  * `6`: Table from DCTune Perceptual Optimization of Compressed Dental X-Rays (1997);
+  * `7`: Table from A Visual Detection Model for DCT Coefficient Quantization (1993);
+  * `8`: Table from An Improved Detection Model for DCT Coefficient Quantization (1993).
+
+**Note:** `IMGPROXY_JPEG_TRELLIS_QUANT`, `IMGPROXY_JPEG_OVERSHOOT_DERINGING`, `IMGPROXY_JPEG_OPTIMIZE_SCANS`, and `IMGPROXY_JPEG_QUANT_TABLE` require libvips to be built with [MozJPEG](https://github.com/mozilla/mozjpeg) since standard libjpeg ddoesn't support those optimizations.
+
+### Advanced PNG compression
+
 * `IMGPROXY_PNG_INTERLACED`: when true, enables interlaced PNG compression. Default: false;
 * `IMGPROXY_PNG_INTERLACED`: when true, enables interlaced PNG compression. Default: false;
 * `IMGPROXY_PNG_QUANTIZE`: when true, enables PNG quantization. libvips should be built with libimagequant support. Default: false;
 * `IMGPROXY_PNG_QUANTIZE`: when true, enables PNG quantization. libvips should be built with libimagequant support. Default: false;
 * `IMGPROXY_PNG_QUANTIZATION_COLORS`: maximum number of quantization palette entries. Should be between 2 and 256. Default: 256;
 * `IMGPROXY_PNG_QUANTIZATION_COLORS`: maximum number of quantization palette entries. Should be between 2 and 256. Default: 256;
@@ -100,7 +122,8 @@ imgproxy can use the `Width`, `Viewport-Width` or `DPR` HTTP headers to determin
 * `IMGPROXY_WATERMARK_DATA`: Base64-encoded image data. You can easily calculate it with `base64 tmp/watermark.png | tr -d '\n'`;
 * `IMGPROXY_WATERMARK_DATA`: Base64-encoded image data. You can easily calculate it with `base64 tmp/watermark.png | tr -d '\n'`;
 * `IMGPROXY_WATERMARK_PATH`: path to the locally stored image;
 * `IMGPROXY_WATERMARK_PATH`: path to the locally stored image;
 * `IMGPROXY_WATERMARK_URL`: watermark image URL;
 * `IMGPROXY_WATERMARK_URL`: watermark image URL;
-* `IMGPROXY_WATERMARK_OPACITY`: watermark base opacity.
+* `IMGPROXY_WATERMARK_OPACITY`: watermark base opacity;
+* `IMGPROXY_WATERMARKS_CACHE_SIZE`: <img class="pro-badge" src="assets/pro.svg" alt="pro" /> size of custom watermarks cache. When set to `0`, watermarks cache is disabled. By default 256 watermarks are cached.
 
 
 Read more about watermarks in the [Watermark](watermark.md) guide.
 Read more about watermarks in the [Watermark](watermark.md) guide.
 
 
@@ -224,3 +247,4 @@ imgproxy can send logs to syslog, but this feature is disabled by default. To en
 * `IMGPROXY_BASE_URL`: base URL prefix that will be added to every requested image URL. For example, if the base URL is `http://example.com/images` and `/path/to/image.png` is requested, imgproxy will download the source image from `http://example.com/images/path/to/image.png`. Default: blank.
 * `IMGPROXY_BASE_URL`: base URL prefix that will be added to every requested image URL. For example, if the base URL is `http://example.com/images` and `/path/to/image.png` is requested, imgproxy will download the source image from `http://example.com/images/path/to/image.png`. Default: blank.
 * `IMGPROXY_USE_LINEAR_COLORSPACE`: when `true`, imgproxy will process images in linear colorspace. This will slow down processing. Note that images won't be fully processed in linear colorspace while shrink-on-load is enabled (see below).
 * `IMGPROXY_USE_LINEAR_COLORSPACE`: when `true`, imgproxy will process images in linear colorspace. This will slow down processing. Note that images won't be fully processed in linear colorspace while shrink-on-load is enabled (see below).
 * `IMGPROXY_DISABLE_SHRINK_ON_LOAD`: when `true`, disables shrink-on-load for JPEG and WebP. Allows to process the whole image in linear colorspace but dramatically slows down resizing and increases memory usage when working with large images.
 * `IMGPROXY_DISABLE_SHRINK_ON_LOAD`: when `true`, disables shrink-on-load for JPEG and WebP. Allows to process the whole image in linear colorspace but dramatically slows down resizing and increases memory usage when working with large images.
+* `IMGPROXY_APPLY_UNSHARPEN_MASKING`: <img class="pro-badge" src="assets/pro.svg" alt="pro" /> when `true`, imgproxy will apply unsharpen masking to the resulting image if one is smaller than the source. Default: `true`.

+ 36 - 1
docs/generating_the_url_advanced.md

@@ -209,6 +209,17 @@ As an approximate guideline, use 0.5 sigma for 4 pixels/mm (display resolution),
 
 
 Default: disabled
 Default: disabled
 
 
+#### Pixelate <img class="pro-badge" src="assets/pro.svg" alt="pro" />
+
+```
+pixelate:%size
+pix:%size
+```
+
+When set, imgproxy will apply the pixelate filter to the resulting image. `size` is the size of a pixel.
+
+Default: disabled
+
 #### Watermark
 #### Watermark
 
 
 ```
 ```
@@ -235,6 +246,28 @@ Puts watermark on the processed image.
 
 
 Default: disabled
 Default: disabled
 
 
+#### Watermark URL <img class="pro-badge" src="assets/pro.svg" alt="pro" />
+
+```
+watermark_url:%url
+wmu:%url
+```
+
+When set, imgproxy will use the image from the specified URL as a watermark. `url` is Base64-encoded URL of the custom watermark.
+
+Default: blank
+
+#### Style <img class="pro-badge" src="assets/pro.svg" alt="pro" />
+
+```
+style:%style
+st:%style
+```
+
+When set, imgproxy will prepend `<style>` node with provided content to the `<svg>` node of source SVG image. `%style` is url-safe Base64-encoded CSS-style.
+
+Default: blank
+
 #### Preset
 #### Preset
 
 
 ```
 ```
@@ -322,7 +355,9 @@ When using encoded source URL, you can specify the [extension](#extension) after
 
 
 Extension specifies the format of the resulting image. At the moment, imgproxy supports only `jpg`, `png`, `webp`, `gif`, `ico`, `heic`, and `tiff`, them being the most popular and useful image formats.
 Extension specifies the format of the resulting image. At the moment, imgproxy supports only `jpg`, `png`, `webp`, `gif`, `ico`, `heic`, and `tiff`, them being the most popular and useful image formats.
 
 
-**Note:** Read about GIF support [here](image_formats_support.md#gif-support).
+<img class="pro-badge" src="assets/pro.svg" alt="pro" /> Also you can yse `mp4` extension to convert animated images to MP4.
+
+**Note:** Read more about image formats support [here](image_formats_support.md).
 
 
 The extension part can be omitted. In this case, imgproxy will use source image format as resulting one. If source image format is not supported as resulting, imgproxy will use `jpg`. You also can [enable WebP support detection](configuration.md#webp-support-detection) to use it as default resulting format when possible.
 The extension part can be omitted. In this case, imgproxy will use source image format as resulting one. If source image format is not supported as resulting, imgproxy will use `jpg`. You also can [enable WebP support detection](configuration.md#webp-support-detection) to use it as default resulting format when possible.
 
 

+ 3 - 1
docs/generating_the_url_basic.md

@@ -89,7 +89,9 @@ When using encoded source URL, you can specify the [extension](#extension) after
 
 
 Extension specifies the format of the resulting image. At the moment, imgproxy supports only `jpg`, `png`, `webp`, `gif`, `ico`, `heic`, and `tiff`, them being the most popular and useful image formats.
 Extension specifies the format of the resulting image. At the moment, imgproxy supports only `jpg`, `png`, `webp`, `gif`, `ico`, `heic`, and `tiff`, them being the most popular and useful image formats.
 
 
-**Note:** Read about GIF support [here](image_formats_support.md#gif-support).
+<img class="pro-badge" src="assets/pro.svg" alt="pro" /> Also you can yse `mp4` extension to convert animated images to MP4.
+
+**Note:** Read more about image formats support [here](image_formats_support.md).
 
 
 The extension part can be omitted. In this case, imgproxy will use source image format as resulting one. If source image format is not supported as resulting, imgproxy will use `jpg`. You also can [enable WebP support detection](configuration.md#webp-support-detection) to use it as default resulting format when possible.
 The extension part can be omitted. In this case, imgproxy will use source image format as resulting one. If source image format is not supported as resulting, imgproxy will use `jpg`. You also can [enable WebP support detection](configuration.md#webp-support-detection) to use it as default resulting format when possible.
 
 

+ 7 - 0
docs/image_formats_support.md

@@ -8,6 +8,7 @@ At the moment, imgproxy supports only the most popular image formats:
 * GIF;
 * GIF;
 * ICO;
 * ICO;
 * SVG _(source only)_;
 * SVG _(source only)_;
+* MP4 _(result only)_ <img class="pro-badge" src="assets/pro.svg" alt="pro" />;
 * HEIC;
 * HEIC;
 * BMP;
 * BMP;
 * TIFF.
 * TIFF.
@@ -39,3 +40,9 @@ Since processing of animated images is pretty heavy, only one frame is processed
 * `IMGPROXY_MAX_ANIMATION_FRAMES`: the maximum of animated image frames to being processed. Default: `1`.
 * `IMGPROXY_MAX_ANIMATION_FRAMES`: the maximum of animated image frames to being processed. Default: `1`.
 
 
 **Note:** imgproxy summarizes all frames resolutions while checking source image resolution.
 **Note:** imgproxy summarizes all frames resolutions while checking source image resolution.
+
+## Converting animated images to MP4 <img class="pro-badge" src="assets/pro.svg" alt="pro" />
+
+Animated images results can be converted to MP4 by specifying `mp4` extension.
+
+Since MP4 requires usage of a `<video>` tag instead of `<img>`, automatic conversion to MP4 is not provided.

+ 17 - 3
docs/watermark.md

@@ -6,9 +6,9 @@ imgproxy supports watermarking processed images with another image.
 
 
 There are three ways to specify a watermark image using environment variables:
 There are three ways to specify a watermark image using environment variables:
 
 
-* `IMGPROXY_WATERMARK_DATA` - Base64-encoded image data. You can easily calculate it with `base64 tmp/watermark.webp | tr -d '\n'`.
-* `IMGPROXY_WATERMARK_PATH` - path to the locally stored image.
-* `IMGPROXY_WATERMARK_URL` - watermark image URL.
+* `IMGPROXY_WATERMARK_DATA`: Base64-encoded image data. You can easily calculate it with `base64 tmp/watermark.webp | tr -d '\n'`.
+* `IMGPROXY_WATERMARK_PATH`: path to the locally stored image.
+* `IMGPROXY_WATERMARK_URL`: watermark image URL.
 
 
 You can also specify the base opacity of watermark with `IMGPROXY_WATERMARK_OPACITY`.
 You can also specify the base opacity of watermark with `IMGPROXY_WATERMARK_OPACITY`.
 
 
@@ -39,3 +39,17 @@ Where arguments are:
   * `re`: replicate watermark to fill the whole image;
   * `re`: replicate watermark to fill the whole image;
 * `x_offset`, `y_offset` - (optional) specify watermark offset by X and Y axes. Not applicable to `re` position;
 * `x_offset`, `y_offset` - (optional) specify watermark offset by X and Y axes. Not applicable to `re` position;
 * `scale` - (optional) floating point number that defines watermark size relative to the resulting image size. When set to `0` or omitted, watermark size won't be changed.
 * `scale` - (optional) floating point number that defines watermark size relative to the resulting image size. When set to `0` or omitted, watermark size won't be changed.
+
+## Custom watermarks <img class="pro-badge" src="assets/pro.svg" alt="pro" />
+
+You can use a custom watermark specifying its URL with `watermark_url` processing option:
+
+```
+watermark_url:%url
+wmu:%url
+```
+
+Where `url` is Base64-encoded URL of the custom watermark.
+
+By default imgproxy caches 256 custom watermarks with adaptive replacement cache (ARC). You can change the cache size with `IMGPROXY_WATERMARKS_CACHE_SIZE` environment variable. When `IMGPROXY_WATERMARKS_CACHE_SIZE` is set to `0`, the cache is disabled.
+