Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Copy Paste ImageNew to Visual Studio Code? Get it now.
Copy Paste Image

Copy Paste Image

Tiramisu News

|
2 installs
| (0) | Free
自动保存粘贴的图片到项目目录并插入markdown链接,支持重命名图片并更新所有引用
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Copy Paste Image

A powerful VS Code extension for seamlessly pasting images into Markdown files with intelligent features including image deduplication, smart renaming, and automatic reference updates.

Extension Icon

Features

🖼️ Smart Image Pasting

  • Clipboard Integration: Automatically detects and saves images from clipboard (screenshots, copied image files)
  • Original Filename Preservation: Maintains original filenames when copying image files
  • Timestamp Generation: Auto-generates timestamp-based filenames for screenshots
  • Format Support: Supports PNG, JPEG, GIF, BMP, WebP formats

🔄 Intelligent Image Deduplication

  • Content Hash Detection: Uses MD5 algorithm to detect duplicate images
  • Smart Scanning: Automatically scans attachment folders for existing images
  • Direct Reference: References existing files instead of creating duplicates
  • Storage Optimization: Reduces project size by avoiding duplicate image storage

🏷️ Smart Image Renaming

  • Bulk Reference Updates: Automatically updates all Markdown references when renaming images
  • Safe Renaming: Validates filenames and prevents conflicts
  • Reference Preview: Shows all files that reference the image before renaming
  • Confirmation Dialog: Displays complete file paths for user confirmation
  • Intelligent Matching: Precise filename matching to avoid false replacements

📁 File Migration

  • Batch Move/Copy: Move or copy linked files in Markdown documents with automatic link updates
  • Reference Tracking: Automatically updates all Markdown references when files are moved
  • Safe Operations: Validates file operations and prevents conflicts
  • Workspace Integration: Seamlessly integrates with VS Code's file management

🔧 Intelligent Link Repair

  • Broken Link Detection: Automatically scans and identifies invalid file links in Markdown documents
  • Smart File Matching: Uses advanced algorithms to find potential replacement files based on filename similarity
  • Multiple Suggestions: Provides ranked suggestions with confidence scores for each broken link
  • Flexible Repair Options: Choose to fix, delete, or skip each broken link individually
  • Relative Path Correction: Automatically calculates correct relative paths based on file locations

⚡ Seamless Integration

  • Markdown Focus: Works seamlessly in Markdown files
  • Fallback Behavior: Executes default paste in non-Markdown files
  • Context Menu: Right-click rename functionality in Explorer
  • Keyboard Shortcuts: Standard Ctrl+V/Cmd+V integration

Installation

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search for "Copy Paste Image"
  4. Click Install
  5. Reload VS Code

Usage

Basic Image Pasting

  1. Copy an image to clipboard (screenshot, copy image file, etc.)
  2. Open a Markdown file in VS Code
  3. Press Ctrl+V (Windows/Linux) or Cmd+V (macOS)
  4. The image will be automatically saved and a Markdown link inserted

Image Renaming with Reference Updates

  1. Right-click on an image file in the Explorer
  2. Select "重命名图片并更新引用" (Rename Image and Update References)
  3. Enter the new filename
  4. Confirm the operation
  5. All Markdown references will be automatically updated

File Migration

  1. Open a Markdown file containing links to local files
  2. Right-click in the editor and select "迁移当前文件的链接文件" (Migrate Linked Files)
  3. Choose operation type:
    • Move: Move files to target directory
    • Copy: Copy files to target directory
  4. Set target directory (defaults to assets folder in project root)
  5. Review reference warnings if files are used by other Markdown files
  6. Confirm the operation
  7. All file links in the current document will be automatically updated

Intelligent Link Repair

  1. Open a Markdown file that may contain broken links
  2. Right-click in the editor and select "智能修复文件链接" (Fix Broken Links)
  3. The extension will scan all links in the document and identify broken ones
  4. For each broken link, you'll see:
    • Suggestions: Ranked list of potential replacement files with confidence scores
    • Options: Fix with suggested file, delete the link, or skip
  5. Choose the appropriate action for each broken link
  6. All selected fixes will be applied automatically with correct relative paths

File Conflict Handling

When pasting an image with an existing filename, you'll get these options:

  • Overwrite: Replace the existing file
  • Rename: Save with a new filename
  • Reference Only: Insert link to existing file without saving
  • Cancel: Cancel the operation

Configuration

Configure the extension in VS Code settings:

{
    "copyPasteImage.path": "images",
    "copyPasteImage.prefix": "image",
    "copyPasteImage.suffix": "${YY}${MM}${DD}${HH}${mm}${ss}",
    "copyPasteImage.searchPath": ""
}

Settings Description

Setting Description Default
copyPasteImage.path Relative path for saving images (relative to workspace root) "images"
copyPasteImage.prefix Prefix for image filenames "image"
copyPasteImage.suffix Suffix for image filenames with time variables "${YY}${MM}${DD}${HH}${mm}${ss}"
copyPasteImage.searchPath Directory path for finding image references (empty = entire workspace) ""

Time Variables

  • ${YY}: Year (2-digit)
  • ${MM}: Month (2-digit)
  • ${DD}: Day (2-digit)
  • ${HH}: Hour (2-digit)
  • ${mm}: Minute (2-digit)
  • ${ss}: Second (2-digit)

Supported Platforms

  • ✅ Windows
  • ✅ macOS
  • ✅ Linux

Requirements

  • VS Code 1.74.0 or higher
  • Node.js (for development)

Known Issues

  • Large images may take a moment to process
  • Some clipboard formats may not be supported on all platforms

Release Notes

1.2.1

  • FIXED: 修复了当Markdown文件位于子文件夹时相对路径计算错误的问题
  • FIXED: 解决了生成过多../前缀导致路径错误的问题
  • CONFIRMED: 智能修复链接和文件迁移功能已可通过命令面板(Cmd+Shift+P)访问

1.2.0

  • NEW: Intelligent link repair functionality
  • NEW: Automatic detection and fixing of broken file links
  • NEW: Smart file matching with confidence scoring
  • IMPROVED: Fixed relative path calculation for Markdown files in subdirectories
  • IMPROVED: Enhanced path handling for cross-platform compatibility
  • FIXED: Resolved package-lock.json formatting issues

1.1.0

  • Added file migration feature for Markdown documents
  • Batch move/copy linked files with automatic link updates
  • Reference checking to prevent broken links
  • Enhanced user interface with operation selection dialog

1.0.0

  • Initial release
  • Smart image pasting with automatic saving
  • Intelligent deduplication
  • Smart renaming with reference updates
  • Seamless VS Code integration

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

Development

# Clone the repository
git clone https://github.com/your-username/vscode-copy-paste-image.git

# Install dependencies
npm install

# Compile TypeScript
npm run compile

# Watch for changes
npm run watch

# Package the extension
npm run package

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any issues or have feature requests, please create an issue on GitHub.


Enjoy seamless image management in your Markdown files! 🎉

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft