file-converter

This skill provides comprehensive file format conversion capabilities. It should be used when users need to convert files between different formats, including PDF to Word, Word to PDF, image format conversions (PNG/JPG/WebP/BMP/GIF/TIFF), and Excel/CSV bidirectional conversion. Supports both single file and batch processing. Trigger keywords: 转换, convert, 格式转换, PDF转Word, Word转PDF, 图片转换, Excel转CSV, CSV转Excel.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "file-converter" with this command: npx skills add besteva-file-converter

File Converter Skill

A comprehensive file format conversion toolkit supporting documents, images, and spreadsheets.

When to Use

Activate this skill when any of these scenarios occur:

  • Document conversion: User wants to convert between PDF and Word formats
  • Image conversion: User needs images in a different format (PNG→JPG, JPG→WebP, etc.)
  • Spreadsheet conversion: User needs to exchange data between Excel and CSV
  • Batch operations: User has multiple files that need converting at once
  • Format queries: User asks about supported formats or how to convert specific file types

Supported Conversions

Source FormatTarget FormatScriptNotes
.pdf.docxscripts/pdf_to_word.pyExtracts text, tables, layout
.docx, .doc.pdfscripts/word_to_pdf.pyRequires MS Word on Windows
PNG/JPEG/WebP/BMP/GIF/TIFFAny other image formatscripts/image_converter.pyQuality control, resize support
.csv.xlsxscripts/excel_csv_converter.pyCustom delimiter/encoding
.xlsx, .xls.csvscripts/excel_csv_converter.pyMulti-sheet support

Prerequisites

Python Dependencies

Install required packages before first use:

pip install Pillow pdf2docx docx2pdf openpyxl xlrd

Quick install command:

pip install Pillow pdf2docx docx2pdf openpyxl xlrd

Platform-Specific Requirements

  • Word → PDF (Windows): Microsoft Word must be installed (docx2pdf uses COM automation)
  • PDF → Word: No external software required; uses pdf2docx
  • Image conversion: Uses Pillow only, works on all platforms

Workflow Guidelines

Step 1: Identify Conversion Type

Determine what the user wants to convert:

User says "convert this PDF"        → PDF to Word
User says "turn this into PDF"       → Word to PDF  
User says "change this PNG to JPG"   → Image conversion
User says "export this Excel as CSV" → Excel to CSV

Step 2: Check Dependencies

Before running any script, verify required packages are installed:

python -c "import PIL; import pdf2docx; import docx2pdf; import openpyxl"

If imports fail, prompt user to run:

pip install Pillow pdf2docx docx2pdf openpyxl xlrd

Step 3: Execute Appropriate Script

PDF → Word

Single file:

python scripts/pdf_to_word.py <input.pdf> [output.docx]

Batch mode:

python scripts/pdf_to_word.py --batch ./pdf_folder --output-dir ./output_folder

Options:

  • --start N: Start from page N (default: 0)
  • --end N: End at page N (default: all pages)

Word → PDF

Single file:

python scripts/word_to_pdf.py <input.docx> [output.pdf]

Batch mode:

python scripts/word_to_pdf.py --batch ./docs_folder --output-dir ./pdfs_folder

Check requirements:

python scripts/word_to_pdf.py --check

Image Format Conversion

Single file:

python scripts/image_converter.py <input_image> --format <target_format>

Batch mode:

python scripts/image_converter.py --batch ./images_dir --format webp --output-dir ./webp_dir

Target formats: png, jpg/jpeg, webp, bmp, gif, tiff/tif

Options:

  • -q/--quality N: Quality for lossy formats (1-100, default: 95)
  • --resize WIDTH HEIGHT: Resize dimensions
  • --no-optimize: Disable optimization
  • --info: Display image info without converting

Examples:

# High-quality JPEG compression
python scripts/image_converter.py photo.png --format jpg -q 90

# Convert to WebP with smaller size
python scripts/image_converter.py photo.png --format webp -q 80

# Resize while converting
python scripts/image_converter.py large.png --format jpg --resize 1920 1080

# View image info
python scripts/image_converter.py image.png --info

Excel ↔ CSV

CSV → Excel:

python scripts/excel_csv_converter.py data.csv --format xlsx [options]

Excel → CSV:

python scripts/excel_csv_converter.py data.xlsx --format csv [options]

Batch mode:

python scripts/excel_csv_converter.py --batch ./data_dir --format csv

Options:

  • -d/--delimiter CHAR: Custom separator (default: comma)
  • -e/--encoding ENC: File encoding (default: utf-8)
  • --sheet NAME: Specific sheet name (Excel→CSV)
  • --sheet-name NAME: Output sheet name (CSV→Excel)
  • --no-header: Skip header row
  • --info: Show Excel structure info

Examples:

# European-style CSV (semicolon delimited)  
python scripts/excel_csv_converter.py data.csv --format xlsx -d ";"

# Chinese encoding support
python scripts/excel_csv_converter.py data.xlsx --format csv -e gbk

# Export specific sheet
python scripts/excel_csv_converter.py workbook.xlsx --format csv -s "Sales Report"

# View Excel info
python scripts/excel_csv_converter.py data.xlsx --info

Step 4: Verify Results

After each conversion:

  1. Confirm output file(s) exist at expected location(s)
  2. Report file sizes to user (original vs converted)
  3. For batch operations, report success count vs total count
  4. If errors occurred, summarize them clearly

Error Handling

Common Issues and Solutions

ErrorCauseSolution
ModuleNotFoundErrorMissing packageRun pip install <package>
COMError (Word→PDF)MS Word not installedInstall MS Office or use alternative
UnicodeDecodeErrorWrong encodingSpecify correct --encoding
FileNotFoundErrorWrong pathVerify input path is absolute or relative correctly
Permission deniedRead-only directoryUse writable output directory

Encoding Guide

When dealing with non-UTF-8 files, common encodings:

  • Chinese Windows: gbk / gb18030
  • Western Europe: latin-1 / cp1252
  • Japanese: shift-jis / cp932
  • Auto-detect: Try utf-8 first, then fallback

Best Practices

  1. Always use absolute paths when calling scripts to avoid path confusion
  2. Create output directories before batch operations if they don't exist
  3. Check dependencies once at start of session, not before every call
  4. Report results clearly with file paths, sizes, and success/failure counts
  5. Handle transparency appropriately — JPEG doesn't support alpha channels
  6. Preserve quality defaults are high (95%) but adjust based on use case

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

office secretary

A digital administrative assistant for Microsoft 365 (Outlook & OneDrive).

Registry SourceRecently Updated
1.2K0Profile unavailable
Research

LLM Knowledge Bases

Inspired by a public workflow shared by Andrej Karpathy (@karpathy). From raw research to a living Markdown knowledge base that compounds with every question...

Registry SourceRecently Updated
2330Profile unavailable
General

Meiguang Car Insurance

车险保单PDF字段提取工具 v5.0.2(美光/大地/太平洋/浙商/亚太/人保/华海)。输入PDF文件夹,输出Excel。支持14字段,含车辆使用性质多数纠正、PDAA/PDZA表格兜底、Excel中文UTF-8编码修复。

Registry SourceRecently Updated
1861Profile unavailable
General

Cn Pdf Assistant

PDF文档处理工具。本地处理PDF文件,支持文本提取、智能摘要、表格导出、关键词问答、PDF拆分。纯本地处理,保护文档隐私。

Registry SourceRecently Updated
1310Profile unavailable