File: filling.rst

package info (click to toggle)
thumbor 7.7.7-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 40,556 kB
  • sloc: xml: 295,435; python: 18,673; ansic: 1,479; makefile: 360; sh: 27
file content (120 lines) | stat: -rw-r--r-- 3,712 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
Filling
=======

Usage: `fill(color[,fill_transparent])`

Description
-----------

This filter returns an image sized exactly as requested
independently of its ratio. It will fill the missing area with the specified color.
It is usually combined with the "fit-in" or "adaptive-fit-in" options.

Arguments
---------

-  ``color`` - the color name (like in HTML) or hexadecimal RGB expression
   without the "#" character (see
   `<https://en.wikipedia.org/wiki/Web_colors>`_ for example).

   If color is "transparent" and the image format, supports transparency the
   filling color is transparent.

   .. warning::

      Some engines (like OpenCV engine) do not support transparency.

   If color is "auto", a color is smartly chosen (based on the image pixels)
   as the filling color.

   If color is "blur", the missing parts are filled with blurred original image.

-  ``fill_transparent`` - a boolean to specify whether transparent areas of the
   image should be filled or not. Accepted values are either `true`, `false`,
   `1` or `0`. This argument is optional and the default value is `false`.

Example #1
----------

The original image is:

.. image:: images/tom_before_brightness.jpg
    :alt: Original picture

::

    http://localhost:8888/unsafe/fit-in/300x300/filters:fill(blue)/https%3A%2F%2Fgithub.com%2Fthumbor%2Fthumbor%2Fraw%2Fmaster%2Fexample.jpg

.. image:: images/fillblue.jpg
    :alt: Picture after the fill(blue) filter

::

    http://localhost:8888/unsafe/fit-in/300x300/filters:fill(f00)/https%3A%2F%2Fgithub.com%2Fthumbor%2Fthumbor%2Fraw%2Fmaster%2Fexample.jpg

.. image:: images/fillred.jpg
    :alt: Picture after the fill(f00) filter

::

    http://localhost:8888/unsafe/fit-in/300x300/filters:fill(add8e6)/https%3A%2F%2Fgithub.com%2Fthumbor%2Fthumbor%2Fraw%2Fmaster%2Fexample.jpg

.. image:: images/filllightblue.jpg
    :alt: Picture after the fill(add8e6)

::

    http://localhost:8888/unsafe/fit-in/300x300/filters:fill(auto)/https%3A%2F%2Fgithub.com%2Fthumbor%2Fthumbor%2Fraw%2Fmaster%2Fexample.jpg

.. image:: images/fillauto.jpg
    :alt: Picture after the fill(auto) filter (since 3.7.1)

::

    http://localhost:8888/unsafe/fit-in/300x300/filters:fill(blur)/https%3A%2F%2Fgithub.com%2Fthumbor%2Fthumbor%2Fraw%2Fmaster%2Fexample.jpg

.. image:: images/fillblur.jpg
    :alt: Picture after the fill(blur) filter (since 6.7.1)

Example #2
----------

The original image is:

.. image:: images/dice_transparent_background.png
    :alt: Original picture

::

    http://localhost:8888/unsafe/fit-in/300x225/filters:fill(blue,1)/https://github.com/thumbor/thumbor/wiki/dice_transparent_background.png

.. image:: images/dice_blue_background.png
    :alt: Picture after the fill(blue) filter

::

    http://localhost:8888/unsafe/fit-in/300x225/filters:fill(f00,true)/https://github.com/thumbor/thumbor/wiki/dice_transparent_background.png

.. image:: images/dice_red_background.png
    :alt: Picture after the fill(f00) filter

::

    http://localhost:8888/unsafe/fit-in/300x225/filters:fill(add8e6,1)/https://github.com/thumbor/thumbor/wiki/dice_transparent_background.png

.. image:: images/dice_lightblue_background.png
    :alt: Picture after the fill(add8e6)

::

    http://localhost:8888/unsafe/fit-in/300x225/filters:fill(auto,true)/https://github.com/thumbor/thumbor/wiki/dice_transparent_background.png

.. image:: images/dice_auto_background.png
    :alt: Picture after the fill(auto) filter (since 3.7.1)

::

    http://localhost:8888/unsafe/fit-in/300x225/filters:fill(blur,true)/https://github.com/thumbor/thumbor/wiki/dice_transparent_background.png

.. image:: images/dice_blur_background.png
    :alt: Picture after the fill(blur) filter (since 6.7.1)