> For the complete documentation index, see [llms.txt](https://brucecodes.gitbook.io/utility-api-python/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://brucecodes.gitbook.io/utility-api-python/using-the-features/pillow.md).

# Pillow

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

### Pillow

| Methods                                                                   |
| ------------------------------------------------------------------------- |
| [Rotate](/utility-api-python/using-the-features/pillow.md#rotate)         |
| [Blur](/utility-api-python/using-the-features/pillow.md#blur)             |
| [Watermarks](/utility-api-python/using-the-features/pillow.md#watermarks) |
| [Crop](/utility-api-python/using-the-features/pillow.md#crop)             |
| [Flip](/utility-api-python/using-the-features/pillow.md#flip)             |
| [Resize](/utility-api-python/using-the-features/pillow.md#resize)         |

#### Rotate

Name: rotate

Parameters: \*Filename, \*degrees

#### Blur

name: blur

Parameters: \*Filename, \*Type: Thge type of blur, intensity&#x20;

Type: simple, box or Gaussian

{% tabs %}
{% tab title="Rotate" %}

```python
import main as up

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

{% endtab %}

{% tab title="Blur" %}

```python
import main as up

image = up.Pillow.blur('filename.png', 'gaussian',  3) #filename, type, intesity
image.show()
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
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)
{% endhint %}

### 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](/utility-api-python/using-the-features/pillow.md#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.

{% tabs %}
{% tab title="Basic Watermark" %}

```python
import main as up

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

{% endtab %}

{% tab title="Watermark" %}

```python
import main as up

image = up.Pillow.watermark('filename.png', 'watermark', 'arial.ttf, 25', '255, 255, 255, 255', 120) #filename, text, font, fontcolor, margin
image.show() #view the result.
```

{% endtab %}
{% endtabs %}

### 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%'.

{% tabs %}
{% tab title="Crop" %}

```python
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
```

{% endtab %}

{% tab title="Flip" %}

```python
import main as up

image = up.Pillow.flip('filename.png', 'vertical') #filename, flip 
image.show() #view the image
```

{% endtab %}

{% tab title="Resize" %}

```python
import main as up

image = up.Pillow.resize('filename.png', 50) #filename, width, height. This will reduce the image's size to 50%.
image.show() # Open the image.
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://brucecodes.gitbook.io/utility-api-python/using-the-features/pillow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
