--- name: file-converter description: Convert & transform files - images (resize, format, HEIC), markdown (PDF/HTML), data (CSV/JSON/YAML/TOML/XML), SVG, base64, text encoding. Cross-platform, single & batch mode. This skill should be used when converting file formats, resizing images, generating PDFs from markdown, or transforming data between formats. author: George Khananaev --- # File Converter Convert files between formats w/ single & batch support. All scripts use consistent CLI patterns. ## When to Use - Convert images between PNG, JPG, WEBP, BMP, TIFF, GIF, ICO, AVIF, HEIC/HEIF - Resize/crop images w/ fit modes (contain, cover, fill, inside, outside) - Convert markdown -> PDF or HTML w/ themes - Convert HTML -> markdown (w/ tag stripping control) - Transform CSV <-> JSON <-> YAML <-> TOML <-> XML - SVG <-> raster conversion (PNG, JPG, WEBP, BMP, TIFF) - Base64 encode/decode files (w/ data URI support, stdin) - Fix text encoding issues (detect, convert w/ error handling strategies) ## Quick Routing | Task | Script | Deps | |------|--------|------| | Image convert/resize | `convert_image.py` | Pillow, pillow-heif (opt) | | Markdown -> HTML | `md_to_html.py` | markdown, pygments | | Markdown -> PDF | `md_to_pdf.py` | markdown + weasyprint\|pdfkit | | HTML -> Markdown | `html_to_md.py` | markdownify, bs4 | | CSV/JSON/YAML/TOML/XML | `csv_json_yaml.py` | pyyaml, tomli-w, xmltodict, dicttoxml (per format) | | SVG convert | `svg_convert.py` | cairosvg, Pillow | | Base64 encode/decode | `base64_codec.py` | (none) | | Text encoding | `text_encoding.py` | chardet (opt) | | Cross-platform utils | `platform_utils.py` | (none) - shared by pdf/svg scripts | ## Install Deps ```bash # All deps (recommended) pip install Pillow markdown pygments weasyprint markdownify beautifulsoup4 cairosvg pyyaml chardet tomli-w xmltodict dicttoxml # Optional pip install pillow-heif # HEIC/HEIF support # Minimal (per task) pip install Pillow # Images only pip install markdown pygments # MD -> HTML only pip install markdown weasyprint # MD -> PDF only (macOS: brew install pango) pip install markdownify beautifulsoup4 # HTML -> MD only pip install pyyaml # YAML support pip install tomli-w # TOML write (read: Python 3.11+ built-in) pip install xmltodict dicttoxml # XML support pip install cairosvg # SVG -> raster (macOS: brew install cairo) pip install chardet # Encoding detection ``` ## CLI Patterns All scripts share consistent arg patterns: ```bash # Single file python3 scripts/