edit | blame | history | raw

2026-06-30 截图尺寸处理

用户目标

/Users/ar/Desktop/Screencapture/SCR-20260630-szrh-2.png 修改为苹果接受的截图尺寸之一:1280 × 8001440 × 9002560 × 16002880 × 1800,并尽量减少图片质量损失。

已完成事项

  • 检查原图尺寸:2310 × 1192 PNG,非 16:10。
  • 选择输出尺寸:2560 × 1600
  • 处理方式:不缩放、不裁切原图;在白色画布上左右居中,顶部对齐,补白到 2560 × 1600
  • 生成文件:/Users/ar/Desktop/Screencapture/SCR-20260630-szrh-2-2560x1600.png

关键决策

  • 不选择裁切,因为裁切到 16:10 会丢失左右内容。
  • 不选择缩放到 1440 × 9001280 × 800,因为会降低清晰度。
  • 不选择放大到 2880 × 1800,因为会产生上采样。
  • 2560 × 1600 可以在不缩放原图的前提下补白,质量损失最小。

文件变更

  • 新增:/Users/ar/Desktop/Screencapture/SCR-20260630-szrh-2-2560x1600.png
  • 原图未覆盖:/Users/ar/Desktop/Screencapture/SCR-20260630-szrh-2.png

核心事实 / 变更快照

  • 变更对象:App Store 截图尺寸。
  • 变更前:2310 × 1192 PNG。
  • 变更后:2560 × 1600 PNG。
  • 处理参数:原图贴到白色 RGBA 画布,偏移 x=125, y=0,底部补白 408px
  • 验证证据:
  • sips -g pixelWidth -g pixelHeight -g format /Users/ar/Desktop/Screencapture/SCR-20260630-szrh-2-2560x1600.png 输出 pixelWidth: 2560pixelHeight: 1600format: png
  • file /Users/ar/Desktop/Screencapture/SCR-20260630-szrh-2-2560x1600.png 输出 PNG image data, 2560 x 1600, 8-bit/color RGBA, non-interlaced
  • 生成脚本在保存前用 ImageChops.difference 验证原图嵌入区域与源图像素一致。

可复用命令 / Runbook

用途:把非 16:10 官网截图补白为苹果接受的 2560 × 1600 PNG,同时不缩放、不裁切原图。

前置条件:本机 Python 环境可导入 Pillow。

设置命令:

python3 - <<'PY'
from pathlib import Path
from PIL import Image, ImageChops

src = Path('/Users/ar/Desktop/Screencapture/SCR-20260630-szrh-2.png')
out = Path('/Users/ar/Desktop/Screencapture/SCR-20260630-szrh-2-2560x1600.png')

img = Image.open(src).convert('RGBA')
canvas = Image.new('RGBA', (2560, 1600), (255, 255, 255, 255))
x = (2560 - img.width) // 2
y = 0
canvas.paste(img, (x, y), img)
crop = canvas.crop((x, y, x + img.width, y + img.height))
if ImageChops.difference(crop, img).getbbox() is not None:
    raise SystemExit('verification failed: pasted content differs from source')
canvas.save(out, format='PNG', optimize=True)
print(f'wrote {out} with source offset x={x}, y={y}')
PY

验证步骤:

sips -g pixelWidth -g pixelHeight -g format /Users/ar/Desktop/Screencapture/SCR-20260630-szrh-2-2560x1600.png
file /Users/ar/Desktop/Screencapture/SCR-20260630-szrh-2-2560x1600.png

搜索关键词:App Store 截图尺寸2560x1600ImageChopsSCR-20260630-szrh-2

未决问题

  • 无。

后续建议

  • 直接把 /Users/ar/Desktop/Screencapture/SCR-20260630-szrh-2-2560x1600.png 上传到苹果后台。