SuperAPI AI Directory

visa-doc-translate

Office & productivity

View repository

Updated 10-16 10:04

About this skill

You are assisting with the translation of documents for visa applications.

Instructions

When the user provides an image file path,AUTOMATICALLY perform the following steps,WITHOUT requesting confirmation:

  1. Image Conversion: If the file is in HEIC format, use sips -s format png <input> --out <output> to convert it to PNG.

  2. Image Rotation:

    • Check the EXIF orientation data.
    • Automatically rotate the image based on the EXIF data.
    • If the EXIF orientation is 6, rotate 90 degrees counterclockwise.
    • Apply additional rotation as needed (if the document appears upside down, try rotating 180 degrees).
  1. OCR Text Extraction:

    • Automatically try multiple OCR methods:
      • macOS Vision framework (preferred on macOS).
      • EasyOCR (cross-platform, no tesseract required).
      • Tesseract OCR (if available).
    • Extract all text information from the document.
    • Identify the document type (bank deposit certificate, employment certificate, retirement certificate, etc.).
  2. Translation:

    • Translate all text content into English at a professional level.
    • Preserve the structure and formatting of the original document.
    • Use professional terminology suitable for visa applications.
    • Keep proper nouns in the original language and note the English in parentheses.
    • For Chinese names, use the pinyin format (e.g., WU Zhengye).
    • Accurately preserve all numbers, dates, and amounts.
  3. PDF Generation:

    • Create a Python script using the PIL and reportlab libraries.
    • Page 1: Display the rotated original image, centered and scaled to fit an A4 page.
    • Page 2: Display the English translation with proper formatting:
      • Title centered and bold.
      • Content left-aligned with appropriate spacing.
      • Professional layout suitable for official documents.
    • Add a note at the bottom: "This is a certified English translation of the original document".
    • Run the script to generate the PDF.
  4. Output: Create a PDF file named <original_filename>_Translated.pdf in the same directory.

Supported Documents

  • Bank deposit certificates
  • Income certificates
  • Employment certificates
  • Retirement certificates
  • Property certificates
  • Business licenses
  • ID cards and passports
  • Other official documents

Technical Implementation

OCR methods (tried in order)

  1. macOS Vision framework(macOS only):

    import Vision
    from Foundation import NSURL
    
  2. EasyOCR(cross-platform):

    pip install easyocr
    
  3. Tesseract OCR(if available):

    brew install tesseract tesseract-lang
    pip install pytesseract
    

Required Python Libraries

pip install pillow reportlab

For the macOS Vision framework:

pip install pyobjc-framework-Vision pyobjc-framework-Quartz

Important Guidelines

  • Do notask the user for confirmation at every step.
  • Automatically determine the best rotation angle.
  • If one OCR method fails, try multiple methods.
  • Ensure all numbers, dates, and amounts are accurately translated.
  • Use clean, professional formatting.
  • Complete the entire process and report the location of the final PDF.

Example Usage

/visa-doc-translate RetirementCertificate.PNG
/visa-doc-translate BankStatement.HEIC
/visa-doc-translate EmploymentLetter.jpg

Output Example

This Skill will:

  1. Extract text using available OCR methods.
  2. Translate into professional English.
  3. Generate a <filename>_Translated.pdf:
    • Page 1: Original document image.
    • Page 2: Professional English translation.

Ideal for submitting visa applications to Australia, the United States, Canada, the United Kingdom, and other countries that require translated documents.