Pillow

Allows you to use some of the basic features of Pillow easily

You can use some of the pillow library's features more simply.

Pillow

Rotate

Name: rotate

Parameters: *Filename, *degrees

Blur

name: blur

Parameters: *Filename, *Type: Thge type of blur, intensity

Type: simple, box or Gaussian

import main as up

image = up.Pillow.rotate('filename.jpg', 45) #filename, degrees
image.show()

Do not forget the parenthesis! Use '()' after every method! If you simply use Pillow.rotate, it won't work! You need to use Pillow.rotate(parameters)

Watermarks

Basic Watermark

name: basic_watermark

parameters: *filename, *text: The text you want the watermark to contain, *font: The font name and size.

Note: With basic_watermark, you cannot customize the color or the position of the text. If you need to customize them, view watermark instead.

Watermark

name: watermark

parameters: *filename, *text: The text you want the watermark to contain, *font: The font name and size, fontcolor: The color and opacity of the font in RBG format. Eg. '255, 0, 0, 255' (red, blue, green, opacity), margin: The space between the text and the bottom right corner.

import main as up

image = up.Pillow.basic_watermark('filename.png', 'My Watermark', 'arial.ttf, 36') 
image.show()

Crop, Flip and Resize

Crop

name: crop

parameters: filename, left: The space from the center to the left you want to crop, right: vice versa, upper: The space from the center to the top you want to crop, lower: vice versha

Flip

name: flip

parameters: filename, flip: How you want to flip the file, eg. Horizontal, Vertical, both

Resize

name: resize

parameters: filename, percentage: Reduce the file size to this percentage. Rmember to provide an integer, eg. '250', not '250%'.

import main as up

image = up.Pillow.crop('filename.png', 100, 100, 200, 100) #filename, left, right, upper, lower
image.show() # view the cropped image

Last updated

Was this helpful?