Upload image file or image URL to the ptpimg.me image hosting.
- Upload local image files
- Rehost images from image services (e.g., from imgur)
- Copy resulting URL to clipboard
- BBCode formatting support
- Command-line and programmatic usage
Using pip (traditional install):
pip install ptpimg_uploaderThis places ptpimg_uploader on your PATH — run it directly afterwards:
ptpimg_uploader image.jpgTo upgrade an existing installation:
pip install --upgrade ptpimg_uploaderUsing uv (no Python setup required):
Install uv from https://docs.astral.sh/uv/getting-started/installation/, then:
Install permanently and run as a regular command (same workflow as pip):
uv tool install ptpimg_uploader
ptpimg_uploader image.jpgTo upgrade:
uv tool upgrade ptpimg_uploaderRun once without installing (useful for trying it out):
uvx ptpimg_uploader image.jpgRun the raw script directly (uv auto-installs dependencies):
uv run ptpimg_uploader.py image.jpgManual Dependencies:
- Required:
requestspackage - Debian/Ubuntu:
apt-get install python3-requests - Other systems:
pip3 install requests
- Debian/Ubuntu:
- Required:
- Optional:
pyperclippackage for clipboard support - Install via:
pip3 install pyperclip - With uv:
uv run --with pyperclip ptpimg_uploader.py --clip image.jpg
- Install via:
- Optional:
- Login to https://ptpimg.me
- Open browser developer tools (View -> Developer -> View Source in Chrome)
- Find
api_keyin the page source - Copy the hexadecimal string (format:
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
Set your API key using either:
Environment variable (recommended):
# Add to your ~/.bashrc or ~/.zshenv
export PTPIMG_API_KEY=your-api-key-hereOr use the command-line option: -k / --api-key
Get help:
ptpimg_uploader -hUpload a local image:
ptpimg_uploader ~/seed/mytorrent/folder.jpgRehost from URL:
ptpimg_uploader https://i.imgur.com/eaT6j3X.jpgMultiple uploads (mix-and-match files and URLs):
ptpimg_uploader ~/seed/mytorrent/folder.jpg https://i.imgur.com/eaT6j3X.jpg--bbcode: URLs will be wrapped in BBCode[img]tags
ptpimg_uploader --bbcode ~/seed/mytorrent/folder.jpg--clip: Place a resulting URL to clipboard (if pyperclip package is installed)
ptpimg_uploader --clip ~/seed/mytorrent/folder.jpg--nobell: Disable completion sound. If output is a terminal, a bell will be ringed on completion.
The package can be used as a library via the upload function for programmatic access.
BSD
- mjpieters - a great refactoring and Python packaging
- lukacoufyl - fixing image upload order