A clear, SEO‑friendly filename helps both humans and search engines.
Breakdown of the example:
| Segment | Meaning | Recommended improvement |
|--------|----------|--------------------------|
| girls | Subject (could be a model, a category) | Keep if relevant to content |
| 6 | Could be a series number | Replace with a descriptive word (e.g., portrait) |
| 20180208 | Date in YYYYMMDD (8 Apr 2018) | Keep if date matters; otherwise, omit |
| 055536 | Time (hhmmss) | Usually unnecessary for web |
| resized | Indicates it’s been processed | Helpful for internal tracking, but not needed for public URLs |
| .jpg | Extension | Keep – JPEG is widely supported | girls 6 20180208 055536 resized imgsrcru install
Better public filename: portrait-girl‑2018‑08‑08‑high‑res.jpg (or portrait-girl-20180808.jpg for brevity).
Best practice:
#!/usr/bin/env bash
# Directory containing original photos
SRC_DIR="raw-photos"
# Destination for resized images
DEST_DIR="web-photos"
mkdir -p "$DEST_DIR"
MAX_W=1600
for img in "$SRC_DIR"/*.jpg; do
filename=$(basename "$img")
# Build output name: keep original base, add -resized
out="$DEST_DIR/$filename%.*-resized.jpg"
magick convert "$img" \
-resize "$MAX_W" \
-strip -interlace Plane -quality 80 "$out"
echo "✅ $out created"
done
Result: Every JPEG in raw-photos/ becomes a 1600‑px wide, optimised version in web-photos/.
# 1. Install ImageMagick (if not already)
# macOS: brew install imagemagick
# Ubuntu: sudo apt-get install imagemagick
# 2. Define the target width. For most desktop sites, 1600px is a safe max.
TARGET_WIDTH=1600
# 3. Resize while preserving aspect ratio.
magick convert \
"girls-6-20180208-055536-original.jpg" \
-resize "$TARGET_WIDTH" \
-strip \
-interlace Plane \
-quality 80 \
"portrait-girl-20180808.jpg"
# 4. Optional: produce a WebP fallback.
magick convert "portrait-girl-20180808.jpg" -quality 80 "portrait-girl-20180808.webp"
Explanation of flags
| Flag | Purpose |
|------|---------|
| -resize 1600 | Scales the image so the longer side becomes 1600 px; height adjusts automatically. |
| -strip | Removes EXIF metadata (GPS, camera info) that isn’t needed for the web. |
| -interlace Plane | Creates a progressive JPEG that loads gradually. |
| -quality 80 | Sets compression quality (adjustable). |
| -strip + -interlace together improve perceived load speed. |