Markdown Images Guide: How to Insert, Add, Resize and Embed Images in Markdown with Size Control
Images make documents more vivid and easier to understand. Markdown's image syntax is concise yet flexible. This tutorial will take you from basic syntax to advanced techniques, helping you master markdown image usage comprehensively.
1. Basic Syntax: Master Image Insertion in 3 Steps
1.1 Basic Syntax Format
The basic syntax format for markdown images is as follows:

Syntax components:
- Start with an exclamation mark
! - Followed by square brackets containing the alt text
- Followed by parentheses containing the image path or URL
- Optional: Add quoted title text after the path
1.2 Practical Usage Examples
Local image examples:


Web image examples:

1.3 Path Usage Guide
Relative paths (recommended):
- Same directory:
photo.jpg - Subdirectory:
images/photo.jpg - Parent directory:
../photos/photo.jpg
Absolute paths:
- Windows:
C:\Users\username\Pictures\screenshot.png - macOS/Linux:
/Users/username/Documents/image.png
Path usage recommendations:
- Use relative paths for better project portability
- Create dedicated image folders (e.g., images/, assets/)
- Use meaningful file names for easier management
- Be aware of path separator differences across operating systems
2. Advanced Techniques: Professional Image Layout
2.1 Adjusting Image Size
Markdown's native syntax cannot directly adjust image size; HTML tags are required:
<img src="chart.png" width="300" height="200" alt="Statistical chart">
<img src="logo.png" width="50%" alt="Responsive image">2.2 Centering Images
Method 1: Using center tag
<center>

</center>Method 2: Using div + CSS
<div style="text-align: center;">
<img src="image.jpg" alt="Centered image" style="max-width: 100%;">
</div>Method 3: Using p tag alignment
<p align="center">
<img src="image.jpg" alt="Centered image" width="400">
</p>2.3 Text Wrapping
<img src="logo.png" style="float:right; margin:0 0 1em 1em;" width="150">
This is the wrapping text content, with the image floating on the right...2.4 Numbered Image Captions

Main content... (see Figure 1)
3. Editor Operation Tips
3.1 VS Code Plugin Recommendations
Essential plugins:
- Markdown Paste: Supports direct pasting of clipboard images
- Paste Image: Customizable save paths
- Markdown All in One: Enhanced Markdown editing features
Usage steps:
- Install plugins: Search and install in VS Code extension marketplace
- Copy image to clipboard (screenshot or local image)
- Press
Ctrl + Alt + V(Windows) orCmd + Option + V(Mac) in Markdown file - Plugin automatically saves image and inserts syntax
3.2 Drag and Drop Insertion
Drag image files directly from file explorer to Markdown editor; most modern editors will automatically generate syntax.
3.3 Editor Comparison
| Editor | Drag & Drop | Live Preview | Cloud Sync | Special Features |
|---|---|---|---|---|
| Typora | ✅ | ✅ | ❌ | Direct screenshot paste |
| VS Code | ✅ | ✅ | ⚠️Plugin required | Image hosting plugin support |
| Obsidian | ✅ | ✅ | ✅ | Auto attachment management |
| Bear | ✅ | ✅ | ✅ | Perfect iOS ecosystem integration |
4. Image Management Best Practices
4.1 File Organization Structure
Project root/
├── docs/
│ ├── README.md
│ └── guide.md
├── images/
│ ├── screenshots/
│ ├── diagrams/
│ └── icons/
└── assets/
└── media/4.2 Naming Conventions
Recommended naming formats:
- Date-description:
2024-01-15-login-interface.png - Function-type:
user-dashboard-screenshot.jpg - Number-description:
fig01-system-architecture.svg
Avoid these naming patterns:
- Spaces:
my photo.jpg - Non-ASCII characters:
用户界面.png - Special symbols:
image@#$.jpg
4.3 Image Optimization Recommendations
Format selection:
- PNG: Suitable for icons, screenshots, transparent backgrounds
- JPG: Suitable for photos, complex images
- SVG: Suitable for vector icons, simple graphics
- WebP: Modern format, small size, high quality
Performance optimization:
- Compress image size (recommended tool: TinyPNG)
- Use appropriate image dimensions
- Avoid scaling large images in web pages
- Prepare different sizes for different devices
5. Image Hosting Services and Cloud Storage
5.1 Free Image Hosting Recommendations
GitHub Image Hosting:
Advantages:
- Completely free
- Stable and reliable
- CDN acceleration support
Disadvantages:
- Requires Git operations
- May be slow in some regions
5.2 Commercial Image Hosting Services
Cloudinary:
- 25GB permanent free tier
- Global CDN
- Advanced image processing
AWS S3:
- Pay-as-you-go pricing
- Enterprise-grade reliability
- Powerful features
5.3 Self-hosted Image Hosting
Use tools like PicGo to configure self-hosted image hosting.
6. Common Issues and Solutions
6.1 Images Not Displaying
Possible causes:
- Incorrect path
- File doesn't exist
- Network image expired
- Permission issues
Solutions:
- Check path spelling
- Confirm file exists
- Use relative paths
- Check file permissions
6.2 Large Images Affecting Load Times
Solutions:
- Use image compression tools
- Adjust image dimensions
- Use WebP format
- Implement lazy loading
6.3 Path Issues
Common errors:
 # Absolute path not portable
 # Filename contains spacesCorrect approach:

 # Wrap with quotes7. Alt Text Best Practices
7.1 Importance of Alt Text
Alt text (alternative text) is crucial in the following situations:
- Provides alternative information when images fail to load
- Screen reader accessibility
- Search engine optimization (SEO)
7.2 Excellent Alt Text Examples
Good examples:


Avoid these patterns:
 # Too simple, not descriptive
 # No alt text at all
 # Doesn't describe image content7.3 Alt Text Writing Principles
- Concise but descriptive
- Describe the main content of the image
- Avoid redundant words like "image" or "photo"
- Consider contextual relevance
- Keep length under 125 characters
8. Advanced Application Scenarios
8.1 Creating Image Galleries
<div style="display: flex; justify-content: space-around; flex-wrap: wrap;">
<img src="image1.jpg" alt="Image 1" style="width: 30%; margin: 10px;">
<img src="image2.jpg" alt="Image 2" style="width: 30%; margin: 10px;">
<img src="image3.jpg" alt="Image 3" style="width: 30%; margin: 10px;">
</div>8.2 Product Showcase Template
## Product Showcase
### Key Features
<table>
<tr>
<td align="center">
<img src="./images/feature1.png" width="200" alt="Feature 1">
<br>
<strong>Smart Recognition</strong>
<br>
<sub>AI-powered image recognition technology</sub>
</td>
<td align="center">
<img src="./images/feature2.png" width="200" alt="Feature 2">
<br>
<strong>Fast Processing</strong>
<br>
<sub>Millisecond response time</sub>
</td>
</tr>
</table>8.3 Interface Comparison Display
| Mobile | Desktop |
| :---: | :---: |
|  |  |
| Responsive design, perfect adaptation | Large screen experience, full features |9. Copyright and Legal Considerations
9.1 Image Copyright
Free stock photo recommendations:
- Unsplash: High-quality free photos
- Pexels: Free images and videos
- Pixabay: Free images, illustrations, vectors
- Freepik: Free vectors and illustrations
9.2 Usage Considerations
- Confirm image usage licenses
- Credit image sources
- Avoid using copyrighted disputed images
- Pay special attention to licensing for commercial use
10. Summary and Recommendations
10.1 Best Practices Summary
- File Management: Store in dedicated directories with standardized naming
- Path Usage: Prioritize relative paths for better project portability
- Image Optimization: Compress size, choose appropriate formats
- Alt Text: Write meaningful alternative text
- Copyright Awareness: Use legally licensed images
10.2 Recommended Tools
Image Editing:
- GIMP (free)
- Photoshop (paid)
- Canva (online design)
Image Compression:
- TinyPNG (online compression)
- ImageOptim (Mac)
- RIOT (Windows)
Image Hosting Management:
- PicGo (cross-platform image hosting tool)
- uPic (Mac image hosting tool)
- ShareX (Windows screenshot + upload)
Through this tutorial, you've mastered the complete usage of markdown images. From basic syntax to advanced techniques, from file management to copyright considerations, this knowledge will help you better use images in Markdown documents and create more vivid and professional content.
Remember, good images not only enhance the visual appeal of documents but also help readers better understand the content. In practical use, choose appropriate methods and tools based on specific needs, and continuously optimize your markdown image usage skills.