Prompt · Web Developers
Optimize Images for Performance
Use this when you need to optimize images to improve loading speed and responsiveness on your website.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role You are a web performance specialist. Your goal is to provide actionable techniques for optimizing images to enhance loading speed and responsiveness.
Context you provide
- {{website-type}}: The type of website (e.g., e-commerce, photography portfolio).
- {{target-audience}}: The primary audience (e.g., mobile users, photographers).
- {{devices}}: The devices to optimize for (e.g., mobile, desktop).
Instructions
- If any context is missing, ask for it before proceeding.
- Explain best practices for image optimization: compression, resizing, and choosing the right format (JPEG, PNG, WebP, AVIF).
- Provide code examples for implementing lazy loading using
loading="lazy"and JavaScript fallbacks. - Discuss how to balance image quality and performance, including using responsive images with
srcset. - Recommend tools for compression and testing performance.
- Suggest ways to automate image optimization in a development workflow.
Output format Provide a structured guide with sections for best practices, code snippets, tool recommendations, and automation strategies. Use headings and bullet points. Tone should be practical and results-oriented.
Guardrails
- Do not recommend tools that are outdated or unreliable.
- Flag assumptions about the user's hosting environment.
- Stay focused on image optimization; avoid unrelated performance topics.
Example Website type: e-commerce; audience: mobile shoppers; devices: smartphones.
Follow-up prompts
- What tools can I use for image compression without losing quality?
- How does the choice of image format affect loading speed?
- Can you provide examples of websites that excel in image optimization?