Files
SnapOtter/apps/docs/zh-CN/tools/image/strip-metadata.md
T
SnapOtterandGitHub f858c4cea0 feat: clearer, disambiguated tool names across all surfaces (#520)
Renames 18 ambiguous or hard-to-search tool names so image tools self-qualify like the other modalities ("Compress" becomes "Compress Image"), and cleans up a few awkward names. Propagated across search (constants.ts), display (en.ts + 20 locales), the OpenAPI base spec + 20 locale specs, and the docs tool-page headings in 21 languages. Removes the duplicate "Normalize Audio" summary shared by the video and audio endpoints. Tool ids and routes are unchanged, so no API paths or bookmarks break.
2026-07-15 21:55:51 +08:00

3.4 KiB
Raw Blame History

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
从图像中移除 EXIF、GPS、ICC 和 XMP 元数据,以保护隐私并减小文件大小。 07f61cdb2c26 human 0beed818cd0e

移除图片元数据

从图像中移除 EXIF、GPS、ICC 色彩配置文件和 XMP 元数据。适用于保护隐私(移除 GPS 坐标、相机信息)以及减小文件大小。

API 端点

移除元数据

POST /api/v1/tools/image/strip-metadata

处理图像并返回移除了所选元数据的清理版本。

检查元数据

POST /api/v1/tools/image/strip-metadata/inspect

以 JSON 形式返回解析后的元数据,不修改图像。适用于在移除前预览存在哪些元数据。

参数(移除)

参数 类型 必填 默认值 说明
stripExif boolean false 移除 EXIF 数据(相机设置、日期等)
stripGps boolean false 仅移除 GPS/位置数据
stripIcc boolean false 移除 ICC 色彩配置文件
stripXmp boolean false 移除 XMP 元数据(Adobe、IPTC
stripAll boolean true 一次性移除所有元数据

stripAlltrue 时,它会覆盖各个单独的标志并移除所有内容。

示例请求

移除所有元数据:

curl -X POST http://localhost:1349/api/v1/tools/image/strip-metadata \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@photo.jpg" \
  -F 'settings={"stripAll": true}'

仅移除 GPS 数据(保留相机信息和色彩配置文件):

curl -X POST http://localhost:1349/api/v1/tools/image/strip-metadata \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@photo.jpg" \
  -F 'settings={"stripAll": false, "stripGps": true}'

检查元数据而不修改:

curl -X POST http://localhost:1349/api/v1/tools/image/strip-metadata/inspect \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@photo.jpg"

示例响应(移除)

{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/photo.jpg",
  "originalSize": 2450000,
  "processedSize": 2380000
}

示例响应(检查)

{
  "filename": "photo.jpg",
  "fileSize": 2450000,
  "exif": {
    "Make": "Canon",
    "Model": "EOS R5",
    "DateTimeOriginal": "2024:03:15 14:30:00",
    "ExposureTime": "1/250",
    "FNumber": 2.8,
    "ISO": 400
  },
  "gps": {
    "GPSLatitudeRef": "N",
    "GPSLatitude": [37, 46, 30],
    "_latitude": 37.775,
    "_longitude": -122.4183
  },
  "icc": {
    "Profile Size": "3144 bytes",
    "Color Space": "RGB",
    "Description": "sRGB IEC61966-2.1"
  },
  "xmp": {
    "CreatorTool": "Adobe Photoshop 25.0"
  }
}

说明

  • 移除后,图像会以其原始格式重新编码。JPEG 使用 mozjpeg 以质量 90 编码,PNG 使用压缩级别 9,WebP 使用质量 85。
  • 如果图像标记了非 sRGB 配置文件,移除 ICC 配置文件可能导致细微的色彩偏移。如果色彩准确性很重要,请使用 stripIcc: false
  • 检查端点会将 GPS 坐标解析为十进制的纬度/经度值(以下划线为前缀)以便使用。
  • 支持的输入格式:JPEG、PNG、WebP、AVIF、TIFF、GIF。