chinese-name-comparator

n8n node to compare Chinese names rendered with different fonts

Package Information

Downloads: 170 weekly / 582 monthly
Latest Version: 0.1.5
Author: HKU Official

Documentation

n8n-nodes-chinese-name-comparator

This is an n8n community node that allows you to compare Chinese names rendered with different fonts using Gemini LLM for visual analysis.

n8n is a fair-code licensed workflow automation platform.

Installation
Operations
Compatibility
Usage
Workflow Example
Resources

Installation

Follow the installation guide in the n8n community nodes documentation.

Manual Installation

  1. Go to your n8n installation directory
  2. Navigate to custom folder (create if it doesn't exist)
  3. Clone or copy this repository
  4. Run npm install in the node directory
  5. Run npm run build
  6. Restart n8n

NPM Installation

npm install n8n-nodes-chinese-name-comparator

Operations

This node supports the following operation:

Render and Compare Names

Renders two Chinese names with different fonts and prepares them for comparison with Gemini LLM.

Input Parameters:

  • Name 1: First Chinese name to compare
  • Name 2: Second Chinese name to compare
  • Font 1: Font file for the first name (TTF or OTF format as base64)
  • Font 2: Font file for the second name (TTF or OTF format as base64)
  • Font 1 Name: Name to use for font 1 registration (default: "font1")
  • Font 2 Name: Name to use for font 2 registration (default: "font2")

Output:

  • name1: The first name provided
  • name2: The second name provided
  • prompt: Formatted prompt for Gemini LLM
  • image1: Base64-encoded PNG image of name1
  • image2: Base64-encoded PNG image of name2
  • geminiPrompt: Prompt ready for Gemini LLM node
  • geminiImages: Array of base64 images for Gemini LLM
  • Binary data: image1 and image2 as PNG files

Compatibility

  • Minimum n8n version: 1.0.0
  • Requires canvas module support
  • Tested with n8n version: 1.0.0

Usage

Basic Workflow Setup

  1. Chinese Name Font Comparator Node

    • Add this node to your workflow
    • Enter the two Chinese names you want to compare
    • Provide font files as base64 strings (or use a previous node to read them)
    • Execute the node
  2. Gemini LLM Node (connect to the output)

    • Use the geminiPrompt field for the prompt
    • Use the geminiImages field for the images
    • The Gemini LLM will analyze the visual differences
  3. Process Results

    • Add additional nodes to handle the Gemini response

Workflow Example

Here's a complete example workflow:

1. Chinese Name Font Comparator Node

Input:
- Name 1: "張偉"
- Name 2: "张伟"
- Font 1: [base64 of traditional Chinese font]
- Font 2: [base64 of simplified Chinese font]

2. Gemini LLM Node

Input:
- Prompt: {{$json.geminiPrompt}}
- Images: {{$json.geminiImages}}

3. IF Node

Check Gemini's confidence level and determine if names match

4. Send Notification

Email or Slack notification with results

Handling Font Files

Since font files need to be provided as base64 strings, you have several options:

Option 1: HTTP Request Node

// Fetch font from URL
// The HTTP Request node will provide binary data
// Connect to a Function node to convert to base64

Option 2: Function Node

// Convert binary font data to base64
const fontBuffer = $binary.data;
const base64Font = fontBuffer.toString('base64');
return { font1: base64Font };

Option 3: Read Binary File Node

// If fonts are local files
// Use Read Binary File node
// Then convert to base64 using Function node

Technical Details

This node uses:

  • canvas library for rendering Chinese characters with custom fonts
  • Temporary file storage for font registration
  • Base64 encoding for font input and image output
  • Integration with Gemini LLM for visual comparison

The node creates 400x200px PNG images with:

  • White background
  • Black text
  • 48px font size
  • Centered text alignment

Example Use Cases

  1. Traditional vs Simplified Chinese: Compare traditional and simplified versions of the same name
  2. Font Compatibility: Check if different fonts render names correctly
  3. Name Verification: Verify if two names are the same despite different fonts
  4. Document Processing: Validate names extracted from documents with different fonts

Resources

License

MIT

Discussion