image/jpeg JPEG Flagship
Identifies JPEG images — the standard lossy-compressed format for photographs.
What it's for
image/jpeg identifies JPEG images — the long-standing standard format for photographs and complex, continuous-tone images, using lossy compression that discards some image data to achieve much smaller file sizes than uncompressed formats. It's the default choice specifically for photographic content, where JPEG's compression algorithm (built around how human vision perceives color and detail loss) produces small files with acceptable visual quality, in contrast to formats better suited for sharp-edged graphics like logos or screenshots.
Format & syntax
Content-Type: image/jpeg
No parameters typically used. Note the file extension inconsistency worth knowing: both .jpg and .jpeg extensions map to this same MIME type — a historical artifact of old filesystem 3-character extension limits (DOS-era 8.3 filename rules) that never fully went away even after that constraint disappeared.
How it's used in practice
- Photographs and photo-realistic images — the default choice for camera photos, product photography, and any continuous-tone image where JPEG's lossy compression trades some quality for significantly smaller file size compared to lossless alternatives.
- User-uploaded profile pictures and photo galleries — most photo upload features accept and often specifically convert to JPEG for storage efficiency, sometimes alongside newer formats like WebP served conditionally based on browser support.
- Web performance optimization — JPEG quality settings (compression level) are a common target for image optimization pipelines, trading file size against visual quality to improve page load performance.
- EXIF metadata storage — JPEG files commonly carry EXIF metadata (camera settings, GPS location, orientation), which is a frequent source of both useful functionality (auto-rotating images based on orientation data) and privacy concerns (location data embedded in shared photos).
Common mistakes & gotchas
- Using JPEG for graphics with sharp edges or transparency needs — JPEG's lossy compression introduces visible artifacts around sharp edges and text, and it has no transparency support at all — using it for logos, icons, or screenshots with text produces noticeably worse results than PNG or SVG would for the same content.
- Re-saving/re-compressing JPEGs repeatedly (generation loss) — because JPEG compression is lossy, each time a JPEG is opened, edited, and re-saved as JPEG again, additional quality is lost cumulatively — a real concern in image editing workflows that don't preserve an original/master copy.
- Forgetting EXIF orientation data causes sideways/upside-down images — photos taken with a phone often store orientation as EXIF metadata rather than physically rotating the pixel data, and image processing that ignores this metadata can display or process images in the wrong rotation.
- Not stripping EXIF metadata before sharing publicly — user-uploaded JPEGs can carry GPS coordinates and other metadata that gets unintentionally exposed if not stripped during upload processing, a real and recurring privacy issue for photo-sharing features.
Comparison & FAQ
| Type | Purpose | Key difference from image/jpeg |
|---|---|---|
| image/png | Lossless compression, supports transparency | Better for graphics/screenshots/logos; larger files for photos than JPEG at similar visual quality |
| image/webp | Modern format, supports both lossy and lossless | Generally smaller files than JPEG at comparable quality, with broad but not universal legacy support |
When should I use JPEG instead of PNG?
For photographs and continuous-tone images where some quality loss is acceptable in exchange for much smaller file size. For graphics with sharp edges, text, or transparency needs, PNG (or SVG for vector graphics) is the better choice.
Why does my image look worse after editing and re-saving it multiple times?
JPEG is a lossy format — every re-save introduces additional compression artifacts cumulatively. Keep an uncompressed or lossless master copy for editing, and only export to JPEG as a final step.
Why is my photo displaying sideways?
Likely an EXIF orientation metadata issue — many cameras/phones store rotation as metadata rather than physically rotating pixel data, and some image processing or display contexts don't respect this metadata correctly.
Should I strip EXIF data from user-uploaded photos?
For any publicly shared or public-facing image, yes — EXIF data can include GPS location and other metadata users likely don't intend to share publicly; stripping it during upload processing is a common and recommended privacy practice.