Files
old-parkingkoncept/parkingkonceptvenv/lib/python3.7/site-packages/PIL/__pycache__/ImageOps.cpython-37.pyc

263 lines
14 KiB
Plaintext
Raw Normal View History

2019-11-17 12:44:16 +01:00
B
(U<>]PF<00>@s<>ddlZddlZddlmZddlmZdd<06>Zdd<08>Zd d
<EFBFBD>Zd0d d <0C>Z d1dd<10>Z
ej ddfdd<13>Z d2dd<15>Z ej fdd<17>Zejfdd<19>Zd3dd<1B>Zd4dd<1D>Zej ddfdd <20>Zd!d"<22>Zd#d$<24>Zd%d&<26>Zd'd(<28>Zd)d*<2A>Zd5d,d-<2D>Zd.d/<2F>ZdS)6<>N<>)<01>Image)<01> isStringTypecCs^t|t<01>rBt|<00>dkr(|\}}\}}qRt|<00>dkrR|\}}}}n|}}}}||||fS)N<><00>)<03>
isinstance<EFBFBD>tuple<6C>len)<05>border<65>left<66>top<6F>right<68>bottom<6F>r<00>0/tmp/pip-install-pc7tm5jb/Pillow/PIL/ImageOps.py<70>_borders
  rcCs$t|<00>r ddlm}|<02>||<01>}|S)Nr)<01>
ImageColor)r<00>rZgetcolor)<03>color<6F>moderrrr<00>_color)s  rcCsV|jdkrtd<02><01>n>|jdkrJ|jdkr@t|<01>dkr@|||}|<00>|<01>Std<06><01>dS)N<>Pzmode P support coming soon)<02>L<>RGBr<00>z!not supported for this image mode)r<00>NotImplementedErrorr Zpoint<6E>IOError)<02>image<67>lutrrr<00>_lut1s


 
rc Cs6|<00><00>}g}<04>xtdt|<03>d<02>D<00>]}|||d<00>}|dk rvy d||<Wn*tk
rtx|D] }d||<q`WYnX|<01>rdd}xtd<02>D]}|||}q<>W||d} xPtd<02>D]D}
| ||
kr<>| ||
} d||
<n||
| 8<d} | dkr<>Pq<>W||d} xZtddd<06>D]J} | || k<04>r>| || } d|| <n|| | 8<d} | dk<01>rP<00>qWxtd<02>D]}
||
<00>rnP<00>qnWx"tddd<06>D]} || <00>r<>P<00>q<>W| |
k<01>r<>|<04>ttd<02><01><01>q d| |
} |
| } xJtd<02>D]>}t|| | <00>}|dk<00>r
d}n|dk<04>rd}|<04>|<07><00>q<>Wq Wt||<04>S)a
Maximize (normalize) image contrast. This function calculates a
histogram of the input image, removes **cutoff** percent of the
lightest and darkest pixels from the histogram, and remaps the image
so that the darkest pixel becomes black (0), and the lightest
becomes white (255).
:param image: The image to process.
:param cutoff: How many percent to cut off from the histogram.
:param ignore: The background pixel value (use None for no background).
:return: An image.
rrN<>d<00><><00><><EFBFBD><EFBFBD><EFBFBD>g<00>o@) <09> histogram<61>ranger <00> TypeError<6F>extend<6E>list<73>int<6E>appendr)r<00>cutoff<66>ignorer#rZlayer<65>h<>ix<69>nZcut<75>lo<6C>hi<68>scale<6C>offsetrrr<00> autocontrastAsd  
   
  




 


r3r!<00>cCs|jdkst<01>|dkr<d|kr4|kr4dksjnt<01>n.d|krd|krd|krddksjnt<01>t|d<05>}t|d<05>}|dk r<>t|d<05>}g}g}g} x<td|<04>D].}
|<07>|d<00>|<08>|d<00>| <09>|d<00>q<>W|dk<08>r<>td||<00>} x<>| D]<5D>}
|<07>|d|
|d|dt| <0B><00>|<08>|d|
|d|dt| <0B><00>| <09>|d|
|d|dt| <0B><00>q<>W<00>n8td||<00>} td||<00>} x<>| D]<5D>}
|<07>|d|
|d|dt| <0C><00>|<08>|d|
|d|dt| <0C><00>| <09>|d|
|d|dt| <0C><00><00>q<>Wx<>| D]<5D>}
|<07>|d|
|d|dt| <0A><00>|<08>|d|
|d|dt| <0A><00>| <09>|d|
|d|dt| <0A><00><00>q2WxBtdd|<00>D]0}
|<07>|d<00>|<08>|d<00>| <09>|d<00><00>q<>W|<00>d<05>}t|||| <00>S) a<>
Colorize grayscale image.
This function calculates a color wedge which maps all black pixels in
the source image to the first color and all white pixels to the
second color. If **mid** is specified, it uses three-color mapping.
The **black** and **white** arguments should be RGB tuples or color names;
optionally you can use three-color mapping by also specifying **mid**.
Mapping positions for any of the colors can be specified
(e.g. **blackpoint**), where these parameters are the integer
value corresponding to where the corresponding color should be mapped.
These parameters must have logical order, such that
**blackpoint** <= **midpoint** <= **whitepoint** (if **mid** is specified).
:param image: The image to colorize.
:param black: The color to use for black input pixels.
:param white: The color to use for white input pixels.
:param mid: The color to use for midtone input pixels.
:param blackpoint: an int value [0, 255] for the black mapping.
:param whitepoint: an int value [0, 255] for the white mapping.
:param midpoint: an int value [0, 255] for the midtone mapping.
:return: An image.
rNrr!rrrr)r<00>AssertionErrorrr$r)r <00>convertr)rZblackZwhiteZmidZ
blackpointZ
whitepointZmidpointZredZgreenZblue<75>iZ range_mapZ
range_map1Z
range_map2rrr<00>colorize<7A>sJ&.




**2
**0
**0
r8)g<00>?g<00>?c Cs2|j|j}t|d<00>|d}||kr8|j||d<03>}n<>t<04>|j||<03>}||kr<>t|j|j|d<00>}||dkr<>|j|d|f|d<03>}t|d|tdt |dd<02><02><00>} |<07>
|d| f<02>nnt|j|j|d<00>}
|
|dkr<>|j|
|df|d<03>}t|d|
tdt |dd<02><02><00>} |<07>
|| df<02>|S)a9
Returns a sized and padded version of the image, expanded to fill the
requested aspect ratio and size.
:param image: The image to size and crop.
:param size: The requested output size in pixels, given as a
(width, height) tuple.
:param method: What resampling method to use. Default is
:py:attr:`PIL.Image.NEAREST`.
:param color: The background color of the padded image.
:param centering: Control the position of the original image within the
padded version.
(0.5, 0.5) will keep the image centered
(0, 0) will keep the image aligned to the top left
(1, 1) will keep the image aligned to the bottom
right
:return: An image.
rr)<01>resample) <0B>width<74>height<68>float<61>resizer<00>newrr(<00>max<61>min<69>paste) r<00>size<7A>methodr<00> centeringZim_ratioZ
dest_ratio<EFBFBD>outZ
new_height<EFBFBD>yZ new_width<74>xrrr<00>pad<61>s"  $ $rHcCs6t|<01>\}}}}|<00>|||jd||jd|f<04>S)a/
Remove border from image. The same amount of pixels are removed
from all four sides. This function works on all image modes.
.. seealso:: :py:meth:`~PIL.Image.Image.crop`
:param image: The image to crop.
:param border: The number of pixels to remove.
:return: An image.
rr)r<00>croprB)rr
r r r rrrrrI s rIcCsV|dkr|<00><00>S|dkr"td<03><01>n0tt||j<00><01>tt||j<00><01>f}|<00>||<02>SdS)a<>
Returns a rescaled image by a specific factor given in parameter.
A factor greater than 1 expands the image, between 0 and 1 contracts the
image.
:param image: The image to rescale.
:param factor: The expansion factor, as a float.
:param resample: An optional resampling filter. Same values possible as
in the PIL.Image.resize function.
:returns: An :py:class:`~PIL.Image.Image` object.
rrz!the factor must be greater than 0N)<07>copy<70>
ValueErrorr(<00>roundr:r;r=)rZfactorr9rBrrrr1s 
$r1cCs|<00>|jtj|<01>|<00>|<02>S)aL
Deform the image.
:param image: The image to deform.
:param deformer: A deformer object. Any object that implements a
**getmesh** method can be used.
:param resample: An optional resampling filter. Same values possible as
in the PIL.Image.transform function.
:return: An image.
)Z transformrBrZMESHZgetmesh)rZdeformerr9rrr<00>deform1s rMc Cs<>|jdkr|<00>d<02>}|<00>|<01>}g}x<>tdt|<02>d<04>D]<5D>}dd<06>|||d<00>D<00>}t|<05>dkrr|<03>ttd<04><01><01>q4t<07>t j
|<05>|dd }|s<>|<03>ttd<04><01><01>q4|d
}x.td<04>D]"}|<03> ||<00>||||}q<>Wq4Wt ||<03>S) a<>
Equalize the image histogram. This function applies a non-linear
mapping to the input image, in order to create a uniform
distribution of grayscale values in the output image.
:param image: The image to equalize.
:param mask: An optional mask. If given, only the pixels selected by
the mask are included in the analysis.
:return: An image.
rrrrcSsg|] }|r|<01>qSrr)<02>.0<EFBFBD>_frrr<00>
<listcomp>Oszequalize.<locals>.<listcomp>rr"r!r) rr6r#r$r r&r'<00> functools<6C>reduce<63>operator<6F>addr)r) r<00>maskr,r<00>bZhisto<74>stepr.r7rrr<00>equalize?s


 rXc
Csdt|<01>\}}}}||jd|}||jd|}t<02>|j||ft||j<04><02>} | <09>|||f<02>| S)z<>
Add border to the image
:param image: The image to expand.
:param border: Border width, in pixels.
:param fill: Pixel fill value (a color value). Default is 0 (black).
:return: An image.
rr)rrBrr>rrrA)
rr
<00>fillr r r rr:r;rErrr<00>expand^s rZgcCs<>t|<04>}d|dkr dks*nd|d<d|dkrBdksLnd|d<d|kr`dksfnd}||jd||jdf}|jd|dd|jd|ddf}t|d<00>|d}t|d<00>|d}||kr<>|d} |d}
n4||k<05>r||d} |d}
n|d} |d|}
|d|d| |d} |d|d|
|d} | | | | | |
f} |j||| d<07>S)a<>
Returns a sized and cropped version of the image, cropped to the
requested aspect ratio and size.
This function was contributed by Kevin Cazabon.
:param image: The image to size and crop.
:param size: The requested output size in pixels, given as a
(width, height) tuple.
:param method: What resampling method to use. Default is
:py:attr:`PIL.Image.NEAREST`.
:param bleed: Remove a border around the outside of the image from all
four edges. The value is a decimal percentage (use 0.01 for
one percent). The default value is 0 (no border).
Cannot be greater than or equal to 0.5.
:param centering: Control the cropping position. Use (0.5, 0.5) for
center cropping (e.g. if cropping the width, take 50% off
of the left side, and therefore 50% off the right side).
(0.0, 0.0) will crop from the top left corner (i.e. if
cropping the width, take all of the crop off of the right
side, and if cropping the height, take all of it off the
bottom). (1.0, 0.0) will crop from the bottom left
corner, etc. (i.e. if cropping the width, take all of the
crop off the left side, and if cropping the height take
none from the top, and therefore all off the bottom).
:return: An image.
grg<00>?g<00>?rr)Zbox)r'rBr<r=)rrBrCZbleedrDZ bleed_pixelsZ live_sizeZlive_size_ratioZ output_ratioZ
crop_widthZ crop_heightZ crop_leftZcrop_toprIrrr<00>fitos0"

 
 r[cCs |<00>tj<02>S)zq
Flip the image vertically (top to bottom).
:param image: The image to flip.
:return: An image.
)<03> transposer<00>FLIP_TOP_BOTTOM)rrrr<00>flip<69>sr^cCs
|<00>d<01>S)zi
Convert the image to grayscale.
:param image: The image to convert.
:return: An image.
r)r6)rrrr<00> grayscale<6C>sr_cCs.g}xtd<01>D]}|<01>d|<00>qWt||<01>S)zc
Invert (negate) the image.
:param image: The image to invert.
:return: An image.
rr!)r$r)r)rrr7rrr<00>invert<72>sr`cCs |<00>tj<02>S)zq
Flip image horizontally (left to right).
:param image: The image to mirror.
:return: An image.
)r\r<00>FLIP_LEFT_RIGHT)rrrr<00>mirror<6F>srbcCs@g}dd|d}xtd<04>D]}|<02>||@<00>q Wt||<02>S)z<>
Reduce the number of bits for each color channel.
:param image: The image to posterize.
:param bits: The number of bits to keep for each channel (1-8).
:return: An image.
r<00>rr)r$r)r)r<00>bitsrrUr7rrr<00> posterize<7A>s
re<00><>cCsBg}x2td<01>D]&}||kr&|<02>|<03>q|<02>d|<00>qWt||<02>S)z<>
Invert all pixel values above a threshold.
:param image: The image to solarize.
:param threshold: All pixels above this greyscale level are inverted.
:return: An image.
rr!)r$r)r)r<00> thresholdrr7rrr<00>solarize<7A>s  rhcCsl|<00><00>}|<01>d<01>}tjtjtjtjtjtjtj d<02><07>|<02>}|dk rd|<00>
|<03>}|d=|<01> <0B>|j d<|S|<00> <0A>S)z<>
If an image has an EXIF Orientation tag, return a new image that is
transposed accordingly. Otherwise, return a copy of the image.
:param image: The image to transpose.
:return: An image.
i)r<00>r<00><00><00>rcN<>exif)Zgetexif<69>getrraZ
ROTATE_180r]Z TRANSPOSEZ
ROTATE_270Z
TRANSVERSEZ ROTATE_90r\<00>tobytes<65>inforJ)rrmZ orientationrCZtransposed_imagerrr<00>exif_transposes 


rq)rN)Nrr!r4)r)N)rr)rf)rQrSrrZ_utilrrrrr3r8ZNEARESTrHrIr1ZBILINEARrMrXrZr[r^r_r`rbrerhrqrrrr<00><module>s,   
L
T,


U