Skip to content

Universal different files converter using python script | Multiple Contributors | Add your own conversation function. | Follow the guideline #55

@bhargavnova

Description

@bhargavnova

Objective

Developing a versatile Python script that serves as a universal file converter, capable of converting various file formats to different formats. This tool will provide users a seamless way to convert files such as documents, images, audio, and more, enabling compatibility across different applications and platforms.

Features

  • Support for Multiple Formats: Implement the ability to convert files between different formats, including but not limited to documents (e.g., PDF to DOCX), images (e.g., PNG to JPEG), audio (e.g., MP3 to WAV), etc.

  • User-Friendly Interface: Provide a clear and intuitive interface for users to select input and output formats, and specify file paths.

  • Batch Conversion: Allow users to convert multiple files at once for increased efficiency.

Example Usage

import file_converter

# for standalone function, but for the main script we will be using the argument from the shell.
# Convert a PDF document to a Word document
file_converter.convert('input.pdf', 'output.docx', input_format='pdf', output_format='docx')

# Convert a PNG image to a JPEG image
file_converter.convert('input.png', 'output.jpg', input_format='png', output_format='jpeg')

# Convert an MP3 audio file to a WAV audio file
file_converter.convert('input.mp3', 'output.wav', input_format='mp3', output_format='wav')

Difficulty: Beginner/Intermediate/Advanced

Tags: Python, File Conversion, Universal Converter, Compatibility

Additional Information

  • Consider using libraries like Pillow for image conversion, pdf2docx for PDF to DOCX conversion, and appropriate libraries for other formats.
  • Ensure that the script provides informative error messages in case of invalid input or other issues during the conversion process.

Contribution Guidelines

The updated guidelines can be found here.

Important Note:

  • It's not a single person's job to write this script, I am adding this as an issue so that you can comment first, on what you can add, and work on that so that another person doesn't work on the same function.
  • Note that whoever comments about what they will add, other people should avoid working on that, until that person says otherwise.
  • you can use third-party libraries if it can not be done with Python from scratch easily.
  • just need to add your own code and update the config.json file,
  • I have added one first function and conversation, so use that as your reference.

Happy Coding!!

Please follow the below guidelines.

  1. folder name must be convert_{ext1}_to_{ext2} (ex: convert_srt_to_lrc) #btw both are lyrics files extensions
  2. add a script with the same name as the folder name.
  3. add __init__.py inside the same folder.
  4. write your code using OOP for beginners if they don't know that, you can simply write a function also no worries as long as that works :). if it's OOP based then main method will be according to first point. and for funtion the name will be according to first point.
  5. after writing modify the config.yml file, to add your function in the main script, that's it, I have already configured the convert_me.py script, so no need to modify anything.
  6. currently all the functions will take only two arguments, input_file_path and output_file_path, but if you want to add more, you might need to modify the code in the convert_me.py file
  7. that's it, Check the README.md file in the folder convert_srt_to_lrc, you can add your GitHub username there. under Features section.

Tracker

Done Conversion can be worked on? Bugs Contributor Improvement Required
🟢 srt to lrc Y @bhargavnova Y
🟢 pdf to docx Y Y @harshjais369 Y
[ ] pdf to txt
[ ] pdf to html
[ ] pdf to image (jpg, png, etc.) Y
🟡 docx to pdf @naylin-dev Y (Only works for windows, because docx2pdf requires Microsoft word, Linux support required)
[ ] docx to txt
[ ] docx to html
[ ] docx to pdf
🟢 txt to pdf Y @pranalibose
🟢 txt to csv Y @kom-senapati
🟢 csv to json Y @scove
🟢 csv to xml Y @scove
[ ] csv to excel (xlsx)
🟢 json to csv Y @scove
[ ] json to xml
[ ] xml to json
[ ] xml to csv
[ ] image (jpg, png, etc.) to pdf Y
[ ] image (jpg, png, etc.) to text
[ ] image (jpg, png, etc.) to grayscale Y
[ ] audio (mp3, wav, etc.) to text
[ ] audio (mp3, wav, etc.) to spectrogram image
[ ] video (mp4, etc.) to audio (mp3, wav, etc.) Y
[ ] video (mp4, etc.) to images (frames) Y
[ ] video (mp4, etc.) to gif Y
[ ] audio (mp3, wav, etc.) to spectrogram image
[ ] html to pdf Y
[ ] html to text Y
[ ] html to image Y
[ ] html to docx Y
[ ] html to markdown Y
🟢 markdown to html Y @kom-senapati
[ ] markdown to pdf Y
[ ] markdown to docx Y
[ ] epub to pdf Y
🔴 epub to mobi
[ ] mobi to pdf
[ ] pdf to epub
🔴 pdf to mobi
[ ] excel (xlsx, csv) to pdf Y
[ ] excel (xlsx, csv) to html Y
[ ] excel (xlsx, csv) to json
[ ] excel (xlsx, csv) to xml
[ ] excel (xlsx, csv) to text
[ ] xml to excel (xlsx, csv)
🔴 pdf to excel (xlsx, csv)
🔴 pdf to json
🔴 pdf to xml

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or requestexampleEither work on this example or submit something of your ownget-started 🌟Submit idea, what you want to work on....good first issueGood for newcomershacktoberfestHacktoberfest 2023 contributionshacktoberfest-2024help wantedExtra attention is neededpythonpython-modulePython utility/resuable module, which can be imported in different scriptspython-scriptPython utility/automation script

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions