Fetching Relevant Images
Find, fetch, and legally use images from the web. Covers Wikimedia Commons, free sources, copyright, fair use, and embedding. Use when you need images for any project.
What this skill does
# Fetching Relevant Images
## Use Cases
- Images for HTML templates, documents, presentations
- Need proper attribution and legal use
- Finding high-quality free images
## Source Selection
**Need an image?**
- **Personal/Educational (not published)**: Wikimedia Commons (attribution required) or Unsplash/Pexels/Pixabay (CC0, no attribution)
- **Published (blog, website)**: CC0 sources safest, Wikimedia Commons good with attribution
- **Commercial**: Must use CC0 or commercial licenses
## License Types
| License | Attribution? | Commercial? | Modifications? |
|---------|--------------|-------------|----------------|
| CC0 | No | Yes | Yes |
| CC BY | Yes | Yes | Yes |
| CC BY-SA | Yes | Yes | Yes (same license) |
| Public Domain | No | Yes | Yes |
## Free Image Sources
### CC0 (No Attribution Required)
**Pixabay** (pixabay.com) - 5.7M+ images, proprietary license (formerly CC0), no attribution
**Unsplash** (unsplash.com) - 300K+ photos, high-quality, no attribution
**Pexels** (pexels.com) - Photos/videos, clean aesthetic, no attribution
**Others**: Burst (burst.shopify.com), StockSnap (stocksnap.io)
### Attribution Required
**Wikimedia Commons** (commons.wikimedia.org) - 100M+ files, CC BY or CC BY-SA, best for historical/cultural/educational content
**Flickr Commons** (flickr.com/commons) - Public domain from 70+ institutions
## Workflows
### Option 1: Programmatic Script (Easiest)
Use the helper script for automated extraction:
```bash
# Step 1: Search for images
python3 scripts/fetch_wikimedia_image.py "paella valenciana"
# Step 2: Extract URL from File: page (copy URL from WebSearch results)
python3 scripts/fetch_wikimedia_image.py \
--file-page "https://commons.wikimedia.org/wiki/File:01_Paella_Valenciana_original.jpg" \
--verify --html --alt "Authentic Valencian paella"
```
**Output:**
```
๐ธ Image Information
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Filename: 01_Paella_Valenciana_original.jpg
Direct URL: https://upload.wikimedia.org/wikipedia/commons/e/ed/01_Paella_Valenciana_original.jpg
License: CC BY-SA (check file page for exact version)
Attribution: Photo: Wikimedia Commons, [License]
๐ Verifying URL...
โ
URL verified (HTTP 200, valid image)
๐ HTML Snippet
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
<div class="image-container">
<img src="https://upload.wikimedia.org/..." alt="Authentic Valencian paella">
<div class="image-caption">
Authentic Valencian paella (Photo: Wikimedia Commons, CC BY-SA 2.0)
</div>
</div>
```
**Script location:** `~/.claude/plugins/marketplaces/warren-claude-code-plugin-marketplace/claude-context-orchestrator/snippets/local/documentation/fetching-images/scripts/fetch_wikimedia_image.py`
**Alias tip:** Add to your shell profile:
```bash
alias wikimg='python3 ~/.claude/plugins/marketplaces/warren-claude-code-plugin-marketplace/claude-context-orchestrator/snippets/local/documentation/fetching-images/scripts/fetch_wikimedia_image.py'
```
Then use: `wikimg "mofongo" --count 5`
### Option 2: Manual Workflow (Full Control)
1. **Search**: `site:commons.wikimedia.org [topic] file jpg`
2. **Find File: page**: Navigate to `File:Image_name.jpg`
3. **Extract direct URL**:
```bash
WebFetch("https://commons.wikimedia.org/wiki/File:...",
"Get the direct https://upload.wikimedia.org URL")
```
- Look for: `https://upload.wikimedia.org/wikipedia/commons/[hash]/[filename]`
4. **Verify URL**:
```bash
curl -I "https://upload.wikimedia.org/wikipedia/commons/7/72/2008_Sagrada_Familia_11.JPG"
# Should return: HTTP/2 200
```
5. **Add attribution**:
```html
<img src="https://upload.wikimedia.org/..." alt="Description">
<p class="attribution">Photo: [Author] via Wikimedia Commons, [License]</p>
```
**Attribution formats**:
- "Photo: Wikimedia Commons, CC BY-SA 4.0"
- "Photo: [Photographer] via Wikimedia Commons, CC BY 2.0"
- "Source: Wikimedia Commons (Public Domain)"
### CC0 Sources (Easiest)
1. **Search**: Visit site or `site:unsplash.com [topic]`
2. **Download**: Click Download or copy image address
3. **Use**:
```html
<img src="https://images.unsplash.com/..." alt="Description">
<!-- Attribution optional but appreciated -->
```
## Fair Use (U.S. Law)
Four-factor test determines fair use:
1. **Purpose**: Educational/nonprofit favored, commercial disfavored, transformative favored
2. **Nature**: Factual works favored, creative less favored
3. **Amount**: Small portions favored, entire work disfavored
4. **Market effect**: No harm favored, substitution disfavored
**Important**: Fair use is case-by-case. Educational doesn't automatically qualify. When in doubt, use licensed images.
## Technical Best Practices
### Never Hotlink
โ `<img src="https://someones-site.com/their-image.jpg">`
โ
`<img src="./images/my-image.jpg">` or `<img src="https://upload.wikimedia.org/...">`
### Always Verify URLs
```bash
curl -I "[image-url]" | grep -E "(HTTP|content-type)"
# Should see: HTTP/2 200, content-type: image/jpeg
```
### Wikimedia URL Extraction
โ Don't guess URLs (hash directory is MD5-based, unpredictable)
โ
Extract from File: page using WebFetch
### Responsive Images
```html
<img src="image-800.jpg"
srcset="image-400.jpg 400w, image-800.jpg 800w, image-1200.jpg 1200w"
sizes="(max-width: 600px) 400px, (max-width: 1000px) 800px, 1200px"
alt="Description">
```
### Lazy Loading
```html
<img src="image.jpg" loading="lazy" alt="Description">
```
## Common Mistakes
โ **"I can guess Wikimedia URLs"** โ Hash directories are MD5-based and unpredictable. Always extract from File: page.
- Example: Guessing `/commons/5/50/Image.jpg` when it's actually `/commons/7/72/Image.jpg` = 404 error
- **Solution:** Use WebFetch or the script to extract the real URL
โ **"Skip URL verification"** โ Even correct-looking URLs can be broken. Always verify with curl.
- **Solution:** `curl -I [url] | grep HTTP` should show HTTP 200
โ **"Google Images = free"** โ Check license, use Advanced Search โ Usage Rights โ "Free to use or share"
โ **"Personal use = no copyright"** โ License terms always apply
โ **"Giving credit = allowed"** โ Need proper license, then add attribution
โ **"Educational = fair use"** โ All four factors must be considered
โ **"No watermark = free"** โ Find source and check explicit license
## Lessons from Practice
**From real debugging sessions:**
1. **404 errors from Wikimedia?** โ You guessed the URL structure. Extract it properly instead.
- URLs have hash-based paths: `/commons/[hash]/[filename]`
- The hash is MD5-based on the filename, but unpredictable without calculation
- **Fix:** Always use WebFetch to extract from the File: page
2. **Images not showing in browser?** โ Verify the URL actually works before embedding.
- Even if URL looks correct, test with: `curl -I [url]`
- Check for HTTP 200 and `content-type: image/jpeg`
3. **Which workflow to use?**
- Quick/single image: Use the script (`--file-page --verify --html`)
- Multiple images: Manual WebFetch workflow for batch processing
- Learning/understanding: Manual workflow to see each step
## Code Examples
### HTML with Attribution
```html
<figure>
<img src="https://upload.wikimedia.org/wikipedia/commons/7/72/2008_Sagrada_Familia_11.JPG"
alt="Sagrada Familia stained glass window" loading="lazy">
<figcaption>
Sagrada Familia, Barcelona
<br><small>Photo: Wikimedia Commons, CC BY-SA 2.5</small>
</figcaption>
</figure>
```
### CSS Attribution Styling
```css
.attribution {
font-size: 0.85rem;
color: var(--muted);
font-style: italic;
margin-top: 0.5rem;
}
```
### JavaScript Image Verification
```javascript
const img = new Image();
img.onload = () => console.log('โ
Image loaded:', img.naturalWidth + 'x' + img.naturalHeight);
img.onerror = () => console.error('โ Image failed to load');
img.src = 'your-image-url.jpg';
```
## Quick Checklist
- [ ] LicensRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.