PyConvertAPI Image Converter is a Python library for converting images to different formats using ConvertAPI
Project description
PyConvertAPI Image Converter
PyConvertAPI Image Converter is a Python library for converting images to different formats using ConvertAPI. ConvertAPI is a cloud based file conversion API. It allows you to convert files from one format to another. It supports over 200 different file formats and conversion types. ConvertAPI is a paid service. You can sign up for a free account and get 100 free conversions per month. You can also get a paid account with more conversions per month. You can find more information about ConvertAPI at convertapi.com.
Installation
- Ensure you have python3 and pip installed on your system.
- You can the install PyConvertAPI Image Converter using pip:
pip install pyconvertapi-image-converter
Usage
Importing the library
To use the library, you need to import it into your project. You can import the library using the following code:
import pyconvertapi_image_converter
Creating a ConvertAPIImageConverter object
To create a ConvertAPIImageConverter object as well to as convert an image, you need to provide your ConvertAPI secret. You can get your ConvertAPI secret from your ConvertAPI account. You can create a ConvertAPIImageConverter object using the following code:
from pyconvertapi_image_converter import ConvertAPIImageConverter
# Create a ConvertAPIImageConverter object
converter = ConvertAPIImageConverter('your_secret')
# Convert an image to PNG format
converter.convert(path='path/to/image.jpg', to_format='png')
# Convert an image to SVG format
converter.convert(path='path/to/image.jpeg', to_format='svg')
Converting all images in a directory
To convert all images in a directory, you can use the following code:
from pyconvertapi_image_converter import ConvertAPIImageConverter
converter = ConvertAPIImageConverter('your_secret')
# Convert all images in a directory to PNG format
converter.convert('path/to/directory', to_format='png')
Supported formats
To get a list of supported formats, you can use the following code:
from pyconvertapi_image_converter.image_converter import to_formats, from_formats
# Get a list of supported formats for input files
print(from_formats)
# Get a list of supported formats for output files
print(to_formats)
License
Contributing
Pull requests and feedbacks are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Authors and acknowledgment
Project details
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
Hashes for pyconvertapi_image_converter-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b94615c7750df0312983c66a35c70ca9dc2225bd5a2406bc4f4f61d159ce291 |
|
MD5 | 317d66f4373242fe72d3ed0028de2b1d |
|
BLAKE2b-256 | a6c2ffcdc3968fd3d910bc724c891e03c4fbce2ffdc2cfe6790d65624ff5ed71 |
Hashes for pyconvertapi_image_converter-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d55f23d682511f3bec7b156490c019d67e0cb0350a858ce57ccf1a2a96e5e543 |
|
MD5 | 1c0e944ca75e5b1d7858cc113fad0319 |
|
BLAKE2b-256 | 51de4bb304d66e7253ce3c5a69f61d31384614a117104556b61ad14d570e2225 |