Image Optimization Guide for SEO
Image Optimization Guide for SEO
Images play a critical role in SEO and user experience. This guide will help you optimize your images for better search rankings and faster page loads.
Image Optimization Best Practices
- Use descriptive, keyword-rich filenames
- Bad:
IMG_12345.jpg
- Good:
vansh-gupta-mit-economics-research.jpg
- Bad:
- Always add alt text
- Alt text should be descriptive and include relevant keywords
- Format:
<img src="image.jpg" alt="Descriptive text about the image including keywords">
- Example:
<img src="research-graph.jpg" alt="Graph showing correlation between proximity and innovation in economics research">
- Optimize image dimensions
- Resize images to the exact dimensions needed for your website
- Don’t use CSS to resize large images as this doesn’t reduce file size
- Compress images before uploading
- Use the image optimization script in the
scripts
folder - Run:
bash scripts/optimize-images.sh
- This will create optimized versions in the
images/optimized
folder
- Use the image optimization script in the
- Use responsive images
- The optimization script creates multiple sizes (480px, 768px, 1200px)
- Use the responsive image syntax:
<img srcset="image-480.jpg 480w, image-768.jpg 768w, image-1200.jpg 1200w" sizes="(max-width: 600px) 480px, (max-width: 1200px) 768px, 1200px" src="image.jpg" alt="Description of image">
- Use modern image formats
- The optimization script creates WebP versions
- Use the picture element to provide WebP with fallback:
<picture> <source srcset="image.webp" type="image/webp"> <img src="image.jpg" alt="Description of image"> </picture>
- Add structured data for images
- For important images, add ImageObject schema
- This is especially important for research diagrams and graphs
How to use the optimization script
- Place your original images in the
images
folder - Run
bash scripts/optimize-images.sh
- Use the optimized images from
images/optimized
in your content - Add proper alt text to all images
Checking your image optimization
Use Google’s PageSpeed Insights to verify your images are properly optimized: https://pagespeed.web.dev/
Adding alt text in Markdown

Adding alt text in HTML
<img src="path/to/image.jpg" alt="Descriptive alt text for the image">
Image Optimization Checklist
For all images on your website:
- Compress images before uploading
- Use tools like TinyPNG or ImageOptim
- Aim for file sizes under 200KB for most images
- Use descriptive filenames
- Example:
mit-innovation-research-lab.jpg
instead ofIMG_0123.jpg
- Include relevant keywords in the filename separated by hyphens
- Example:
- Add proper ALT text to all images
- In Markdown:

- In HTML:
<img src="image.jpg" alt="Description of the image" title="Optional title">
- Include your target keywords naturally, but prioritize describing the image accurately
- In Markdown:
- Use responsive images
- Ensure images resize appropriately on mobile devices
- Consider using the
srcset
attribute for different screen sizes
- Add structured data for important images
- Use the ImageObject schema for significant images:
<script type="application/ld+json"> { "@context": "https://schema.org", "@type": "ImageObject", "contentUrl": "https://g-vansh.github.io/images/profile.png", "name": "Vansh Gupta profile photo", "description": "Profile photo of Vansh Gupta, MIT innovation economics researcher" } </script>
- Use the ImageObject schema for significant images:
- Lazy-load images for better page speed
- Add
loading="lazy"
attribute to image tags - Or use a JavaScript library for lazy loading
- Add
Examples of Good ALT Text
- Profile photo:
alt="Vansh Gupta, MIT PhD Researcher specializing in innovation economics"
- Research diagram:
alt="Diagram showing relationship between proximity and innovation rates in urban settings"
- Project screenshot:
alt="Screenshot of GitHub Sponsors Analysis dashboard showing funding patterns"
Image Dimensions Best Practices
- Profile Photos: 500x500px minimum, square format
- Header Images: 1200x630px (optimal for social sharing)
- Blog Post Images: 800-1200px width, consistent height
- Thumbnails: 250-400px width
Remember that properly optimized images improve page load speed, which is a ranking factor for SEO.