用途:为 App Store Connect 准备截图,包括调整尺寸、去除 alpha 透明通道、校验并上传。尺寸标准以 asc CLI 为准,不依赖技能内硬编码的尺寸表。
主要能力与用法:先用 asc screenshots sizes --output table 或 asc screenshots sizes --all --output table 查询当前接受的尺寸;用 asc screenshots validate --path "./screenshots/iphone" --device-type "IPHONE_65" --output table 在本地校验。常见设备类型锚点有 IPHONE_65(6.5 英寸 iPhone)和 IPAD_PRO_3GEN_129(12.9/13 英寸 iPad),其他显示类型需运行 --all 查询。
处理流程:先清理文件名中的隐藏 Unicode 空格;用 sips -g pixelWidth -g pixelHeight 检查尺寸,用 sips -g hasAlpha -g space 检查透明与色彩空间。App Store Connect 拒绝带 alpha 的截图,可通过 JPEG 往返去除:sips -s format jpeg input.png --out /tmp/asc-screenshot-no-alpha.jpg 再转回 PNG。调整尺寸用 sips -z,注意先高后宽,例如 sips -z 2778 1284 input.png --out output.png。必要时用 sips -m 转换为 sRGB。最后用 asc screenshots validate 校验,再执行 asc screenshots upload(可先加 --dry-run)。
限制与注意:尺寸要求会变化,始终以 asc screenshots sizes --all 为准;不要跨不兼容宽高比拉伸;输出到单独文件或目录以保留原图;截图须为 PNG 或 JPEG 且不含 alpha。