Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Tinify API client for Python

**Tinify** is the official Python client for the [TinyPNG](https://tinypng.com) and [TinyJPG](https://tinyjpg.com/) image compression API, enabling developers to intelligently compress, resize, convert and optimize PNG, APNG, JPEG, WebP and AVIF images programmatically. Read more at [https://tinify.com](https://tinify.com/developers).
**Tinify** is the official Python client for the [TinyPNG](https://tinypng.com) and [TinyJPG](https://tinyjpg.com/) image compression API, enabling developers to intelligently compress, resize, convert and optimize PNG, APNG, JPEG, WebP, AVIF and JPEG XL images programmatically. Read more at [https://tinify.com](https://tinify.com/developers).


[Go to the full documentation for the Python client](https://tinypng.com/developers/reference/python).
Expand All @@ -16,7 +16,7 @@

- Compress and optimize images, reducing file size by 50-80% while preserving visual quality
- Resize and crop images with smart compression
- Convert between PNG, JPEG, WebP and AVIF formats
- Convert between PNG, JPEG, WebP, AVIF and JPEG XL formats
- Preserve metadata (optional)
- Upload to storage providers like Amazon S3, Google cloud storage.
- Apply visual transformations with the Tinify API
Expand Down Expand Up @@ -89,19 +89,22 @@ tinify.from_file("original.jpg").resize(
```python
# Convert to WebP format
tinify.from_file("image.png").convert(
type=["image/webp"]
type=tinify.Format.WEBP
).to_file("image.webp")
```

```python
# Convert to smallest format
# (tinify.Format.WEBP, PNG, JPEG, JPG, AVIF, JXL and ANY)
converted = tinify.from_file("image.png").convert(
type=["image/webp", "image/avif", "image/jxl"]
type=[tinify.Format.WEBP, tinify.Format.AVIF, tinify.Format.JXL]
)
extension = converted.result().extension
converted.to_file("image." + extension)
```

The constants are plain strings, so `type="image/webp"` keeps working.

### Compression Count Monitoring

```python
Expand Down
Loading