Processes images with DeepAI and PIL by resizing, cropping to fit specified dimensions, making the background transparent
Project description
DeepAI PNG
This command-line utility processes images by resizing, cropping to fit specified dimensions, making the background transparent, and can be extended to perform other tasks. It leverages the DeepAI Background Remover API and Python's Pillow library for image manipulations.
Features
- Resize and Crop: Adjusts the size of the image to maintain aspect ratio and ensures it fits within a specified square dimension.
- Background Removal: Uses DeepAI's Background Remover API to make the image background transparent.
- Command-Line Interface: Offers a straightforward command-line interface for easy usage in various environments.
Requirements
- Python 3.10 or higher
Installation
DeepAI PNG can be installed easily with pip:
pip install deepaipng
You also need to obtain an API key from DeepAI. Set this API key in your environment as DEEPAI_API_KEY
or pass it directly to the script if modified to accept it as an argument.
Usage
To process an image, specify the input and output file paths, and optionally the target size. Run DeepAI PNG from the command line:
python -m deepaipng --input_path 'path/to/input.jpg' --output_path 'path/to/output.png' --size 120
Arguments
input_path
: Path to the input image file.output_path
: Path to save the output image file.-s
,--size
: Optional. Target size for the output image's width and height in pixels. Defaults to 120.
Configuration
Set your DeepAI API key in your environment to avoid passing it directly with your scripts.
Use the .env
file for local development:
DEEPAI_API_KEY=your_api_key_here
Always keep your API keys secure and avoid committing them to version control. You are responsible for any unauthorized usage of your DeepAI API key.
Load this environment variable with dotenv
when the script runs.
Author
License
This project is licensed under the ISC License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file deepaipng-1.1.2.tar.gz
.
File metadata
- Download URL: deepaipng-1.1.2.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc9d49f4e06b4c1262de2e473c1469fbf92e4eef84a177d1fdf9c116d9f58f48 |
|
MD5 | 7680c30dcfbec347144cc8113c22d44e |
|
BLAKE2b-256 | f23c44548024e3dba032b5eaa9f6dfc8e9b16d4fb6dede493ed50e6e948e5f58 |
File details
Details for the file deepaipng-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: deepaipng-1.1.2-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a80667998cfb9c7475be4ede691ecf340c3df7f81c70ba1e2ce1f1a667e93587 |
|
MD5 | dfc1f5d523098df5ae71c2c90aa2d9e5 |
|
BLAKE2b-256 | 2e7c781307b2253b0f16e8f64047866fc5a8441ff07f903e8c702efc4a39947b |