# OpenCF: The File Conversion Scripts
The `opencf` package provides a collection of Python scripts for file conversion tasks, built on top of the [opencf-core](https://test.pypi.org/project/opencf-core/) framework. These scripts offer functionalities to convert various file formats, including text, CSV, JSON, XML, Excel, and image files, making it easy to handle different types of data transformations efficiently.
## Features
- **Extensive Conversion Support**: The package includes scripts for converting between various file formats, including text, XML, JSON, CSV, and Excel.
- **Integration with `opencf-core`**: Utilizes classes from the `opencf-core` package for file I/O operations, MIME type detection, and exception handling.
- **Modular Converter Classes**: Each conversion script is backed by a custom converter class tailored to handle specific file format conversions, extending the base converter class provided by `opencf-core`.
- **Flexible Input/Output Handling**: Supports reading from and writing to different file formats seamlessly, leveraging the capabilities of `opencf-core`.
- **Custom File Handlers**: Implements custom file reader and writer classes for Excel and image files, demonstrating extensibility and versatility.
- **Command-Line Interface**: Offers a command-line interface for executing file conversion tasks, allowing users to specify input and output file paths and types conveniently.
- **Extensibility**: Other input/output pairs converters can be easily added to augment the existing functionality, providing flexibility for handling a wider range of file formats.
- **Direct Integration**: For specific projects, each converter script can directly leverage the separated package `opencf-core` to build custom converters tailored to project requirements.
## Conversion Handlers
This module provides classes for converting between different file formats. It includes [concrete implementations of conversion classes](./opencf/converters.py) for various file types.
- `TextToTextConverter`: Marge text based files (txt, md, xml, json, ...).
- `XMLToJSONConverter`: Converts XML files to JSON format. (Reader: XmlToStrReader, Writer: DictToJsonWriter)
- `JSONToCSVConverter`: Converts JSON files to CSV format. (Reader: JsonToDictReader, Writer: ListToCsvWriter)
- `CSVToXMLConverter`: Converts CSV files to XML format. (Reader: CsvToListReader, Writer: StrToXmlWriter)
- `XLSXToCSVConverter`: Converts Excel files to CSV format. (Reader: SpreadsheetToPandasReader, Writer: ListToCsvWriter)
- `ImageToPDFConverter`: Converts image files to PDF format. (Reader: ImageToPillowReader)
- `ImageToPDFConverterWithPyPdf2`: Converts image files to PDF format using PyPDF2. (Reader: ImageToPillowReader, Writer: PyPdfToPdfWriter)
- `PDFToImageConverter`: Converts PDF files to image format. (Reader: PdfToPyPdfReader)
- `PDFToImageExtractor`: Extracts images from PDF files. (Reader: PdfToPyPdfReader)
- `ImageToVideoConverterWithPillow`: Converts image files to video format using Pillow. (Reader: ImageToPillowReader, Writer: VideoArrayWriter)
- `ImageToVideoConverterWithOpenCV`: Converts image files to video format using OpenCV. (Reader: ImageToOpenCVReader, Writer: VideoArrayWriter)
- ...
## Getting Started
To use the `opencf` package, follow these steps:
1. Install the package along with its dependencies using your preferred package manager.
2. Import the required classes into your Python scripts or applications, ensuring that the `opencf-core` package is accessible.
3. Utilize the provided converter classes to perform file format conversions as needed, specifying input and output file paths and types.
4. Execute the scripts either programmatically or via the command-line interface, providing necessary arguments for file conversion tasks.
## Example Usage
Here's an example demonstrating how to use the `opencf` package for converting an PNG file to PDF:
```bash
# Install the package along with its dependencies (if not already installed)
pip install -i https://test.pypi.org/simple/ opencf
# Run the converter script
opencf examples/input/example.png -o examples/output/example.pdf
# or
opencf examples/input/example.png -ot pdf
```
This command executes the `ConverterApp` class, initiating the conversion process from an PNG file to a PDF file using the appropriate converter classes.
## Other examples
- pdf to png
You can set, the output argument as a folder. So, the png files would be in that folder. Using a filepath instead of a folder may yield an error.
```bash
opencf examples/input/example.pdf -o examples/output -ot png
```
This command will write png files into the `examples/output` as mentioned
## Contribution
Contributions to the `opencf` package are welcome! Feel free to submit bug reports, feature requests, or pull requests via the GitHub repository. Additionally, consider extending the functionality by adding support for additional file formats or improving existing converter classes.
Raw data
{
"_id": null,
"home_page": "https://github.com/Hermann-web/opencf",
"name": "opencf",
"maintainer": "Hermann Agossou",
"docs_url": null,
"requires_python": "<3.12,>=3.8.1",
"maintainer_email": "agossouhermann7@gmail.com",
"keywords": "file conversion, data processing, file formats",
"author": "Hermann Agossou",
"author_email": "agossouhermann7@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/94/29/54081684f35e22f2edf69d837ca5f726fcdb8f19b1da16628d1439e093ed/opencf-0.3.2.tar.gz",
"platform": null,
"description": "# OpenCF: The File Conversion Scripts\n\nThe `opencf` package provides a collection of Python scripts for file conversion tasks, built on top of the [opencf-core](https://test.pypi.org/project/opencf-core/) framework. These scripts offer functionalities to convert various file formats, including text, CSV, JSON, XML, Excel, and image files, making it easy to handle different types of data transformations efficiently.\n\n## Features\n\n- **Extensive Conversion Support**: The package includes scripts for converting between various file formats, including text, XML, JSON, CSV, and Excel.\n- **Integration with `opencf-core`**: Utilizes classes from the `opencf-core` package for file I/O operations, MIME type detection, and exception handling.\n- **Modular Converter Classes**: Each conversion script is backed by a custom converter class tailored to handle specific file format conversions, extending the base converter class provided by `opencf-core`.\n- **Flexible Input/Output Handling**: Supports reading from and writing to different file formats seamlessly, leveraging the capabilities of `opencf-core`.\n- **Custom File Handlers**: Implements custom file reader and writer classes for Excel and image files, demonstrating extensibility and versatility.\n- **Command-Line Interface**: Offers a command-line interface for executing file conversion tasks, allowing users to specify input and output file paths and types conveniently.\n- **Extensibility**: Other input/output pairs converters can be easily added to augment the existing functionality, providing flexibility for handling a wider range of file formats.\n- **Direct Integration**: For specific projects, each converter script can directly leverage the separated package `opencf-core` to build custom converters tailored to project requirements.\n\n## Conversion Handlers\n\nThis module provides classes for converting between different file formats. It includes [concrete implementations of conversion classes](./opencf/converters.py) for various file types.\n\n- `TextToTextConverter`: Marge text based files (txt, md, xml, json, ...).\n- `XMLToJSONConverter`: Converts XML files to JSON format. (Reader: XmlToStrReader, Writer: DictToJsonWriter)\n- `JSONToCSVConverter`: Converts JSON files to CSV format. (Reader: JsonToDictReader, Writer: ListToCsvWriter)\n- `CSVToXMLConverter`: Converts CSV files to XML format. (Reader: CsvToListReader, Writer: StrToXmlWriter)\n- `XLSXToCSVConverter`: Converts Excel files to CSV format. (Reader: SpreadsheetToPandasReader, Writer: ListToCsvWriter)\n- `ImageToPDFConverter`: Converts image files to PDF format. (Reader: ImageToPillowReader)\n- `ImageToPDFConverterWithPyPdf2`: Converts image files to PDF format using PyPDF2. (Reader: ImageToPillowReader, Writer: PyPdfToPdfWriter)\n- `PDFToImageConverter`: Converts PDF files to image format. (Reader: PdfToPyPdfReader)\n- `PDFToImageExtractor`: Extracts images from PDF files. (Reader: PdfToPyPdfReader)\n- `ImageToVideoConverterWithPillow`: Converts image files to video format using Pillow. (Reader: ImageToPillowReader, Writer: VideoArrayWriter)\n- `ImageToVideoConverterWithOpenCV`: Converts image files to video format using OpenCV. (Reader: ImageToOpenCVReader, Writer: VideoArrayWriter)\n- ...\n\n## Getting Started\n\nTo use the `opencf` package, follow these steps:\n\n1. Install the package along with its dependencies using your preferred package manager.\n2. Import the required classes into your Python scripts or applications, ensuring that the `opencf-core` package is accessible.\n3. Utilize the provided converter classes to perform file format conversions as needed, specifying input and output file paths and types.\n4. Execute the scripts either programmatically or via the command-line interface, providing necessary arguments for file conversion tasks.\n\n## Example Usage\n\nHere's an example demonstrating how to use the `opencf` package for converting an PNG file to PDF:\n\n```bash\n# Install the package along with its dependencies (if not already installed)\npip install -i https://test.pypi.org/simple/ opencf\n\n# Run the converter script\nopencf examples/input/example.png -o examples/output/example.pdf\n# or\nopencf examples/input/example.png -ot pdf\n```\n\nThis command executes the `ConverterApp` class, initiating the conversion process from an PNG file to a PDF file using the appropriate converter classes.\n\n## Other examples\n\n- pdf to png\n\nYou can set, the output argument as a folder. So, the png files would be in that folder. Using a filepath instead of a folder may yield an error.\n\n```bash\nopencf examples/input/example.pdf -o examples/output -ot png\n```\n\nThis command will write png files into the `examples/output` as mentioned\n\n## Contribution\n\nContributions to the `opencf` package are welcome! Feel free to submit bug reports, feature requests, or pull requests via the GitHub repository. Additionally, consider extending the functionality by adding support for additional file formats or improving existing converter classes.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A collection of Python scripts for file conversion tasks, built on top of the opencf-core framework.",
"version": "0.3.2",
"project_urls": {
"Documentation": "https://opencf.readthedocs.io",
"Homepage": "https://github.com/Hermann-web/opencf",
"Repository": "https://github.com/Hermann-web/opencf"
},
"split_keywords": [
"file conversion",
" data processing",
" file formats"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "73a48bef3cd0c32f6ec6194f4ccb39379ca3ea91297b20d3f0f8b8adf955bd0e",
"md5": "189457766592eda323f94bf4abb0cab1",
"sha256": "e299e4fd5d40c63d68dbf1fe61baaf583a8977732b156273d7faab6f5405918d"
},
"downloads": -1,
"filename": "opencf-0.3.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "189457766592eda323f94bf4abb0cab1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.12,>=3.8.1",
"size": 16920,
"upload_time": "2024-05-08T12:30:56",
"upload_time_iso_8601": "2024-05-08T12:30:56.450368Z",
"url": "https://files.pythonhosted.org/packages/73/a4/8bef3cd0c32f6ec6194f4ccb39379ca3ea91297b20d3f0f8b8adf955bd0e/opencf-0.3.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "942954081684f35e22f2edf69d837ca5f726fcdb8f19b1da16628d1439e093ed",
"md5": "8d249410605f9034e9c9c764d6a397ef",
"sha256": "3fb6b3acda1b1997b99423fcad37f630f40f826fd715d7a0efaf68d21058431c"
},
"downloads": -1,
"filename": "opencf-0.3.2.tar.gz",
"has_sig": false,
"md5_digest": "8d249410605f9034e9c9c764d6a397ef",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.12,>=3.8.1",
"size": 12501,
"upload_time": "2024-05-08T12:30:58",
"upload_time_iso_8601": "2024-05-08T12:30:58.399111Z",
"url": "https://files.pythonhosted.org/packages/94/29/54081684f35e22f2edf69d837ca5f726fcdb8f19b1da16628d1439e093ed/opencf-0.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-08 12:30:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Hermann-web",
"github_project": "opencf",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "opencf"
}