Skip to content

Processes image with DeepAI and PIL by resizing, cropping to fit specified dimensions, and removing the background

License

Notifications You must be signed in to change notification settings

DJStompZone/DeepAIPNG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

GitHub Actions Workflow Status Python 3.10 Python 3.11 Python 3.10

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.

About

Processes image with DeepAI and PIL by resizing, cropping to fit specified dimensions, and removing the background

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages