A versatile file and data conversion library
Project description
AGConvert
AGConvert is a versatile file conversion library that supports a wide range of file formats across different categories including images, documents, audio, video, 3D models, code, and archives.
Features
- Image Conversion: Convert between PNG, JPG, BMP, GIF, TIFF, WebP, SVG, and PDF
- Document Conversion: Convert between TXT, PDF, DOCX, HTML, MD, RTF, CSV, XLSX, JSON, XML, and YAML
- Audio Conversion: Convert between MP3, WAV, OGG, FLAC, AAC, and M4A
- Video Conversion: Convert between MP4, AVI, MKV, MOV, WMV, and WebM
- 3D Model Conversion: Convert between OBJ, STL, PLY, and GLTF
- Code Conversion: Convert between JSON, XML, YAML, and CSV
- Archive Conversion: Convert between ZIP, TAR, GZ, BZ2, and 7Z
Installation
Quick Installation
To install all dependencies:
./scripts/install.sh
Specific Installation
To install dependencies for specific conversion types:
./scripts/install_specific.sh --image --document
Available options:
--all: Install all dependencies--core: Install core dependencies--image: Install image conversion dependencies--document: Install document conversion dependencies--audio: Install audio conversion dependencies--video: Install video conversion dependencies--model: Install 3D model conversion dependencies--archive: Install archive conversion dependencies
Usage
Python API
from agconvert import open_convert
# Basic conversion
open_convert('input.png', 'output.jpg')
# Conversion with options
open_convert('input.png', 'output.jpg', quality=85, resize=(800, 600))
Command Line Interface
# Basic conversion
agconvert input.png output.jpg
# Conversion with options
agconvert input.png output.jpg --quality 85 --resize 800x600
Supported Conversion Options
Image Options
quality: Set the quality for lossy formats (1-100)resize: Resize the image (width, height)grayscale: Convert to grayscalerotate: Rotate the image by degrees
Document Options
template: Specify a template for document conversionmetadata: Add metadata to the documenttoc: Include table of contents
Audio Options
bitrate: Set the bitrate for audio conversionsample_rate: Set the sample ratechannels: Set the number of channels
Video Options
resolution: Set the video resolutionfps: Set the frames per secondcodec: Specify the codec to use
Examples
Converting an Image
from agconvert import open_convert
# Convert PNG to JPG
open_convert('image.png', 'image.jpg')
# Convert PNG to JPG with options
open_convert('image.png', 'image.jpg', quality=85, resize=(800, 600))
Converting a Document
from agconvert import open_convert
# Convert Markdown to HTML
open_convert('document.md', 'document.html')
# Convert CSV to Excel
open_convert('data.csv', 'data.xlsx')
Converting Audio
from agconvert import open_convert
# Convert WAV to MP3
open_convert('audio.wav', 'audio.mp3')
# Convert WAV to MP3 with options
open_convert('audio.wav', 'audio.mp3', bitrate='320k')
Running Tests
To run all tests:
python run_tests.py
To run specific test categories:
python run_tests.py -k image
python run_tests.py -k document
Dependencies
AGConvert relies on several libraries for different conversion types:
- Image: Pillow, CairoSVG
- Document: Pandas, OpenPyXL, python-docx, pdfkit, markdown
- Audio: PyDub, SpeechRecognition
- Video: MoviePy
- 3D Model: Trimesh, NumPy
- Archive: py7zr, patool
System dependencies:
- FFmpeg (for audio and video)
- Pandoc (for document conversion)
- Cairo (for SVG conversion)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openconvert-0.1.0.tar.gz.
File metadata
- Download URL: openconvert-0.1.0.tar.gz
- Upload date:
- Size: 33.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7cd10665df89867143d222f3d916612f011f435f66a91134934289d81dc62a9
|
|
| MD5 |
81e8f284e40fd0fc3031c0634727a515
|
|
| BLAKE2b-256 |
7e3fafb8651f37de6cc0257d9d86818400fc8792e955a600d9caa2fb43da76a2
|
File details
Details for the file openconvert-0.1.0-py3-none-any.whl.
File metadata
- Download URL: openconvert-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6457f305405469d22c7bd0dd49ff84c21c6bc8fcf5492aca8de3c3d06593d521
|
|
| MD5 |
b74dccc55209c007c6fd049a15d96a0a
|
|
| BLAKE2b-256 |
53ba200818e568884f122d766648a0bb9b8fcd0d1b0b9bf01014df01f50f842c
|