Python
📸 PichaX SDK (Python)
🚀 Installation
# pip install pichax
pip install git+https://github.com/Chakata-Technologies/pichax_python_sdk.gitExample
from pichax.client import PichaX
picha = PichaX(api_key="your_api_key", api_secret="your_api_secret")
# 🔁 Transform an image
transform_url = (
picha.transform({
"id": "img_123",
"expires": "1725168000", # Unix timestamp
"src": "https://example.com/image.jpg",
"cache": False, # Not required. Default: True
"params": {
"rotate": {"degrees": 45},
"resize": {"w": 100, "h": 200, "mode": "fill"}, # Modes: "fit", "fill", "crop"
# Resize options:
# {"scale": 0.5} -> scale image to 50% of the original size
# {"w": 100} -> keep aspect ratio
"effects": [{"grayscale": True}, {"blur": 10}, {"sharpen": True}],
"format": "jpeg", # Options: "webp", "jpeg", "png"
"quality": 80, # 0 - 100
"watermark": {"text": "Hello there"},
# custom watermarks are only supported in production key
# a default watermark is applied otherwise
"crop": {"x": 100, "y": 30, "w": 100, "h": 20}
# Crop options:
# {"w": 100, "h": 200, "mode": "centre"} -- Modes: "centre", "attention", "entropy"
}
})
.get_url()
)
print(transform_url)
# 👤 Generate an identicon
identicon_url = (
picha.identicon({
"id": "user_123",
"expires": "1725168000",
"name": "PichaX"
})
.get_url()
)
print(identicon_url)🔐 Signature Generation
🧰 Transformations
Crop
Last updated