A powerful command-line tool for converting files between different formats. Currently supports:
- Markdown to PDF: Convert markdown files to beautifully formatted PDFs
- Image format conversion: Convert between various image formats (PNG, JPG, JPEG, SVG, etc.)
- π Fast and efficient: Built with modern Python libraries
- π¨ Beautiful output: Markdown PDFs with proper styling and formatting
- π Multiple formats: Support for various input and output formats
- π» Command-line interface: Easy to use with simple commands
- π οΈ Flexible options: Customize output paths and formats
# Install system dependencies
brew install cairo pango gdk-pixbuf libffi
# Clone and install
git clone https://github.com/Sule57/convert.git
cd convert
chmod +x install.sh
./install.sh# Install system dependencies
sudo apt update
sudo apt install -y python3-venv python3-pip libcairo2 pango1.0-tools libgdk-pixbuf2.0-0 libffi-dev gir1.2-pango-1.0
# Clone and install
git clone https://github.com/Sule57/convert.git
cd convert
chmod +x install.sh
./install.sh# Install system dependencies (requires Chocolatey)
choco install -y python cairo pango gdk-pixbuf libffi
# Clone and install
git clone https://github.com/Sule57/convert.git
cd convert
python -m venv venv
.\venv\Scripts\Activate.ps1
python -m pip install -r requirements.txtAfter running the install script, you need to manually set up the alias in your shell configuration.
# Get the current directory path
pwd
# Add the alias to your zsh configuration
echo 'alias convert="/Users/yourusername/path/to/convert/venv/bin/python3 /Users/yourusername/path/to/convert/convert.py"' >> ~/.zshrc
# Reload your shell configuration
source ~/.zshrc# Get the current directory path
pwd
# Add the alias to your bash configuration
echo 'alias convert="/Users/yourusername/path/to/convert/venv/bin/python3 /Users/yourusername/path/to/convert/convert.py"' >> ~/.bash_profile
# Reload your shell configuration
source ~/.bash_profile# Get the current directory path
pwd
# Add the alias to your bash configuration
echo 'alias convert="/home/yourusername/path/to/convert/venv/bin/python3 /home/yourusername/path/to/convert/convert.py"' >> ~/.bashrc
# Reload your shell configuration
source ~/.bashrc# Get the current directory path
Get-Location
# Create PowerShell profile if it doesn't exist
if (!(Test-Path -Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force
}
# Add the function to your PowerShell profile
Add-Content -Path $PROFILE -Value "`nfunction convert { & 'C:\path\to\convert\venv\Scripts\python.exe' 'C:\path\to\convert\convert.py' `$args }"
# Reload your PowerShell profile
. $PROFILEAfter setting up the alias, test that it works:
convert --helpYou should see the help message for the convert tool. If you get a "command not found" error, make sure you:
- Used the correct path from
pwdin your alias - Reloaded your shell configuration
- Restarted your terminal
If you prefer not to use the install script:
-
Clone the repository:
git clone https://github.com/Sule57/convert.git cd convert -
Create virtual environment:
python3 -m venv venv source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
-
Set up the alias (follow Step 2 above)
# Convert markdown file to PDF
convert -f input.md -t pdf
convert -f input.md -t pdf -o output.pdf
convert -f input.md -o output.pdf
# Convert markdown text directly
convert "Your markdown text here" -t pdf# Convert PNG to JPG
convert -f image.png -t jpg
convert -f image.png -t jpg -o new_image.jpg
convert -f image.png -o new_image.jpg
# Convert SVG to PNG
convert -f logo.svg -t png -o logo.png
# Convert between other formats
convert -f photo.jpg -t png -o photo.png-f, --file: Input file path-t, --type: Output format type (pdf, png, jpg, jpeg, svg, etc.)-o, --output: Output file path (optional)-h, --help: Show help message
# Basic conversion
convert -f README.md -t pdf
# With custom output
convert -f README.md -t pdf -o documentation.pdf
# Convert text directly
convert "# Hello World\nThis is a test." -t pdf -o test.pdf# PNG to JPG
convert -f screenshot.png -t jpg -o screenshot.jpg
# SVG to PNG with custom size
convert -f logo.svg -t png -o logo.png
# JPG to PNG
convert -f photo.jpg -t png -o photo.pngIf you prefer not to use the install script, you can set up manually:
-
Clone the repository:
git clone https://github.com/Sule57/convert.git cd convert -
Create virtual environment:
python3 -m venv venv source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
-
Add alias to your shell config:
echo 'alias convert="/Users/yourusername/path/to/convert/venv/bin/python3 /Users/yourusername/path/to/convert/convert.py"' >> ~/.zshrc
-
Reload shell:
source ~/.zshrc
- Python 3.7+
- Dependencies listed in
requirements.txt
- Markdown:
.md,.markdown - Images:
.png,.jpg,.jpeg,.svg,.bmp,.tiff,.webp
- PDF: From markdown files
- Images:
.png,.jpg,.jpeg,.svg,.bmp,.tiff,.webp
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with WeasyPrint for PDF generation
- Uses Pillow for image processing
- Powered by Click for CLI interface